Advanced Windows PowerShell Scripting Video Training

Advanced Windows PowerShell Scripting Video Training
Advanced Windows PowerShell Scripting Video Training

Wednesday, June 20, 2012

How to reboot all computers in your domain except yours.

OK, this is not exactly what I recommend doing unless you are trying to lose your job.  This is an actual question from one of my PowerShell classes.  SO, here it is, but use at your own risk.
Import-Module ActiveDirectory
$HostName = hostname

Get-ADComputer -filter 'Name -ne $HostName' |
    Select-Object @{Label="ComputerName";Expression={$_.Name}} |
    Restart-ComputerForce

Again, this is not recommended.

No comments: