Shutting down windows domain clients remotely

I was not in the office, but I did have to shut down all domain computers after a move to have them install windows updates over the long new-year weekend.

So I ended up with a script I picked up on the web, and adjusted it to my needs.

The computers in the network were all named dt[number] (dt for desktop).
When looking at the Active Directory and in the DHCP server I found the desktop number range was from 41 to 99 in my case, so I just made sure a remote shutdown command (run as domain admin) was executed with the correct computer name. I saved this as a .bat file and ran it.

@echo off 
set /a x=41
:while 
if %x% lss 100 (
  echo shutting down dt0%x%
  shutdown /m \\dt0%x% /s /t 30 
  set /a x+=1
  goto :while 
)

Hope this helps you!
Have a great new year,
Cheers!

This entry was posted in shutdown, Windows. Bookmark the permalink.