Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

windows 2000 shutdown bactch files

Status
Not open for further replies.

ashley75

Technical User
Oct 4, 2002
94
US
does anyone have a batch file to shutdown Windows 2000???

thanks
 
you can use the shutdown command in the following manner;

shutdown \\machinename /r (for reboot)<amt of time in secs before shutdown>. Ex) shutdown \\machine /r 10
 
shutdown option doesn't work, please see below:
Code:
C:\>shutdown -r -t 10
'shutdown' is not recognized as an internal or external command,
operable program or batch file.

 
I prefer to use WMI. Save the following code to a text file and give it an extension of .VBS. Double click to run. You can enter the machine name or IP.

Code:
'Reboot Workstation Script
'By Mark MacLachlan
'Creation Date 9/18/2002
'Modification 10/7/2002 Added support for confirmation box
'Usage- Double click and enter a machine name or IP address to reboot machine


On Error Resume Next
mname = InputBox("Enter Machine Name", "Reboot Machine")
If Len(mname) = 0 Then Wscript.Quit

if Msgbox("Are you sure you want to reboot machine " & mname, vbYesNo, "Reboot Machine") = vbYes then

		Set OpSysSet = GetObject("winmgmts:{impersonationLevel=impersonate,(RemoteShutdown)}//" & mname).ExecQuery("select * from Win32_OperatingSystem where Primary=true")
		for each OpSys in OpSysSet
			OpSys.Reboot()
 		next
end if

I hope you find this post helpful.

Regards,

Mark
 
shutdown.exe is part of the Windws 2000 Resource Kit, which most administrators would suggest be installed on any Win 2000 server.

Pat Richard, MCSE(2) MCSA:Messaging, CNA(2)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top