Thursday, January 16, 2014

Taskmanagement in powershell

My favorite commands tasklist and taskkill are getting old. Time to get on the powershell bandwagon now when xp is losing its supported-status.

For tasklist-like results

/>get-process |where-object {$_.processname –like msiexec}

Where msiexec is queried process

For taskkill-like results

/>stop-process –name notepad

Where notepad is process to be killed.

Also nice to have

/>restart-computer

Which is pretty obvious. Restart immediatly on default. Use with scheduler for more use.

References:

http://technet.microsoft.com/en-us/library/hh849837.aspx - restart-computer

http://technet.microsoft.com/en-us/library/ee177004.aspx - stop process

http://technet.microsoft.com/en-us/library/hh849781.aspx - stop process

http://technet.microsoft.com/en-us/library/hh849832.aspx - get process

http://www.powershellmagazine.com/2012/11/27/better-restart-computer-cmdlet-in-powershell-3-0/ - restart-computer enhancements in ps3.0

http://jrich523.wordpress.com/2012/11/28/using-powershell-schedule-job-to-reboot-a-computer/

No comments:

Powershell and Uptimerobot

Uptimerobot can be quite tedious when you need to update many monitors at once. For example say you bought the license for Uptimerobot and n...