One of the trickiest things to do when working with computes remotely is reboot them. We also have to make sure that the computers don't have any bios issues that can cause them to not restart. Many times we can't even get logged on if their Terminal Services access is shut off. With this trick you can reboot a server with ease, even one that doesn't have PowerShell installed.
To do this first we get on a computer that does have PowerShell. At the PowerShell prompt, try:
PS C:\> $your_server = gwmi win32_operatingsystem -computer yourservername
If you follow best practices and do not run under a domain admin account, (or an account that is local admin on all your servers) Then you should see an error like this:
Now we want to be able to shutdown a computer, but we need to make sure we're using an account with permissions to reboot the computer in question.
You can use the runas CMD command to launch a PowerShell with the necessary credential.
PS C:\>runas /env /user:administrator@domain.local "powershell.exe"
Then you will be able to link the other computer to your variable, and fire off the simple reboot method.
PS C:\>$your_server = gwmi win32_operatingsystem -computer yourservername
PS C:\>$your_server.reboot()
__GENUS : 2
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
ReturnValue : 0
As long as the ReturnValue is 0 your server should now be on it's way to rebooting! If you want to see what other cool WMI functions you can play with you can pipe the $your_server variable into the Get-Member cmdlet to see what other methods and properties are accessible.
PS C:\>$your_server | Get-Member
Have fun, and stay out of trouble with that one!