RE: Reboot Script for Group Policy?
- From: Umesh Thakur <UmeshThakur@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 6 Jan 2006 02:41:02 -0800
John,
I have a script that I use to reboot remote computers. Fro your scenario, I
would recommend a script that will run on your own computer (or any other
that you want) and it perform following operations:
- There will be text/excel file containing names and reboot times of
respective machines.
- This script will run as a background program, and keep checking for reboot
schedule from above mentioned file, on interval of say 1 second (or whatever
interval you want).
- If an scheduled reboot is found, it will reboot the machine, and inform
you (with a dialog box OR log an entry in event viewer)
However, there is one requirement for this script: Script must run under
user account that has admin rights on respective computers that will be
rebooted. OR, you need to specify admin user acct info in text/excel file
mentioned above, to reboot those machines using those accounts.
Below is script that I uses, to reboot machines remotely:
If you are comfortable enough to tailor it to suit your needs, its great!
else, you can revert back to me.
---------------------------------------------------------
'Script to REBOOT a machine remotely...
'USAGE: RebootRemoteComputer <CompName/IP Address> <Username> [Password]
[Domain] "
'by Umesh Thakur (mailto:umesh.thakur@xxxxxxxxx)
set wsa=Wscript.Arguments
if wsa.count < 2 then
wscript.echo "USAGE: RebootRemoteComputer <CompName/IP Address> <Username>
[Password] [Domain]"
wscript.Quit (0)
end if
strComputer = wsa(0)
strUser=wsa(1)
if wsa.count>=3 then
if wsa(2)<> "*" then
strPassword = wsa(2)
else
Set objPassword = CreateObject("ScriptPW.Password")
Wscript.StdOut.Write "Please enter your password:"
strPassword = objPassword.GetPassword()
end if
else
Set objPassword = CreateObject("ScriptPW.Password")
Wscript.StdOut.Write "Please enter your password:"
strPassword = objPassword.GetPassword()
end if
if wsa.count >=4 then
strDomain=wsa(3)
else
strDomain=strComputer
end if
wscript.echo
wscript.echo "Connecting to computer:" & strComputer & " using Username: " &
strUser & "..."
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
if wsa.count>=4 then 'domain is specified
Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer,
"root\cimv2", strUser, strPassword, "MS_409", "ntlmdomain:" + strDomain)
else
Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer,
"root\cimv2", strUser, strPassword, "MS_409")
end if
Set colOperatingSystems = objSWbemServices.ExecQuery("Select * from
Win32_OperatingSystem")
wscript.echo "Rebooting..."
For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Reboot()
Next
'---------------------------------------------------------------
Umesh Thakur
--
When you are unable to keep your eyes open, do go and sleep for few hours!!!
"RTResolutions_John" wrote:
> Does anyone know of a script that can be deployed via group policy that will
> reboot applicable machines at a specified time (ie Monday - Friday at 2am).
> I've found several that will do it immediately when the script is run but
> none that will do it at a certain time.
>
> Other ways I've come across (ie copying the shutdown.exe app on remote
> machines and setting up a task to run) are impratical for a large org. We
> are a pure Windows 2K environment.
>
> Any help is greatly appreciated!!
.
- Follow-Ups:
- RE: Reboot Script for Group Policy?
- From: RTResolutions_John
- RE: Reboot Script for Group Policy?
- Prev by Date: Re: question: do people still need the Monad bits for .Net Beta 2?
- Next by Date: Re: [MSH] Wikipedia entry on MSH
- Previous by thread: [MSH] Wikipedia entry on MSH
- Next by thread: RE: Reboot Script for Group Policy?
- Index(es):
Relevant Pages
|