Service monitoring
where script: http://www.youdidwhatwithtsql.com/monitoring-starting-services-with-powershell/113 could add a:
elseif($service.name -ne $srv) { write-host "$srv not present on $computer."; }
in addition: how capture output log file or csv?
thank you.
hi,
write-host "$name ""$state"" on $computer."; } } } elseif($service.name -ne $srv) { write-host "$srv not present on $computer."; }
with write-host command, not output result log file.
if want know service status, run below command:
get-service | {$_.name -eq "servicename"} | select status, name |out-file c:\result.t=csv
regards,
yan li
cataleya li
technet community support
Windows Server > Windows PowerShell
Comments
Post a Comment