Archive

Posts Tagged ‘Monitor’

Powershell One-Liners – Process Monitor

As a server admin, I often face a situation where I have to perform an action on the server, but some process is running, and I have to wait.

Rather than sitting around checking the server every 5 minutes, I set a Powershell one-liner monitor with notification:

powershell.exe -command "& {if (! (get-process -name TheService -erroraction SilentlyContinue)){Send-MailMessage -SmtpServer 'theSMTPServer.void.null' -from theserver@rack.room -To 'theadmin@void.null -Subject 'TheService is not running, check theServer'}}"

I simply add the above line same as in the Folder cleaner

/theadminguy

%d bloggers like this: