Viewing 15 posts - 46 through 60 (of 64 total)
Here's a Powershell version. Use the first line if you're running from a Powershell session with SQL 2008 DLLs. The second line if you only have SQL 2005...
January 19, 2012 at 9:39 am
Here's a Powershell version I use. If you want all jobs, enabled or not, just remove the "if ($job.isEnabled) {" line and it's matching "}"
add-type -AssemblyName "Microsoft.SqlServer.Smo, Version=10.0.0.0, Culture=neutral,...
January 19, 2012 at 7:56 am
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | out-null
foreach ($svr in get-content "C:\AllServers.txt")
{
write-host $svr
$srv = New-Object "Microsoft.SqlServer.Management.Smo.Server" "$svr"
$jobList = $srv.jobserver.jobs | where-object {$_.lastrunoutcome -eq "Failed" -and $_.isenabled -eq $TRUE}
foreach($job in $jobList) {
$sql += "Insert YourTableName...
January 5, 2012 at 8:30 am
That's what I was trying to point out but I guess I didn't phrase it correctly.
Get-Item, when looking for file info, should be your friend.
December 16, 2011 at 4:42 pm
If it's a small file that's fine but when working with larger files you'll find a difference in performance between using Get-Content and just looking at the file size.
December 16, 2011 at 1:13 pm
Glad you worked it out but I thought I'd give you another option.
if ($(Get-Item -Path c:\scripts\sysevents.txt).Length -gt 0) { "Send mail" }
else { "Don't send" }
And I agree with ALXDBA,...
December 16, 2011 at 12:42 pm
If you write $result to the console you'll probably see the error right off. Try changing
foreach ($Source in $result)
{
$src = $_.Source
$dest = $_.Destination
...
To
foreach ($Source in $result)
{
$src = $Source.Source
$dest...
December 6, 2011 at 8:51 am
Beejug1983, I just want to bring up a couple of final points regarding the script I posted and some of the things Steve, Jeff and opc.three have brought up. ...
November 30, 2011 at 8:55 am
Get-WmiObject -Class Win32_OperatingSystem |Select Description
November 29, 2011 at 11:09 am
No offense taken Jeff, it’s a reasonable question. I posted the Powershell since the OP asked in this forum. The answer would have been different if the question...
November 29, 2011 at 6:50 am
Very good point Steve. I was trying to show the how, not specific values but I should have made that clear.
At least I first showed how to set the...
November 28, 2011 at 9:57 am
This is for one server and includes system databases but I expect you know how to change to your requirements. The single commented lines are where you can change...
November 28, 2011 at 8:54 am
No real answers here just questions. May be things you’ve already looked at.
1. What account is running the job, does it have the needed permissions?
2. Is the...
November 18, 2011 at 7:19 am
I'm not sure I understand what you changed or why your previous code didn't work. If you want to send any error messages from your prior version maybe we can...
November 16, 2011 at 2:41 pm
Nothing in that script is directed to an output file. Modify the script to send the results to a file if that's what you want. (change C:\data\AllServersResults.txt to whatever...
November 15, 2011 at 8:55 am
Viewing 15 posts - 46 through 60 (of 64 total)