Shutting Down All Computers

WARNING! Be careful when running this script. It will actually shut down all Computers in your Domain

Dim ComputerOp As IADsComputerOperations
Dim NameSpace  As IADsContainer
Dim Computer   As IADsComputer
Dim DomainContainer As IADsContainer
Dim Domain   As IADsDomain
'Bind to the known Namespace.
Set NameSpace = GetObject("NTDS://")
'Enumerate the all domains first
For Each Domain In NameSpace
Set DomainContainer = Domain
DomainContainer.Filter = "Computer"
'Enumerate the all Computers in the Domain
For Each Computer In DomainContainer
 get the IADsComputerOperations interface
 Set ComputerOp = Computer
  'Call Shutdown method of IADsComputerOperations
  ComputerOp.ShutDown True 'True means reboot
 Next Computer
Next Domain