Monday, 30 March 2009

Reboot-Servers

The Need:
After patches have been applied to my servers I like to control the reboot schedule. To do this I break the servers down into groups of 10 or so and run the following script against each list.


The Script:
Get-Content c:\servers.txt | ForEach-Object { gwmi win32_operatingsystem -ComputerName $_ | ForEach-Object { $_.reboot() } | out-null ; write-host "$_ is going down"}

No comments: