RE: Reboot Script for Group Policy?
- From: RTResolutions_John <RTResolutionsJohn@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 6 Jan 2006 10:32:03 -0800
Umesh,
Thanks so much for the code....I really appreciate it. Just a couple of
quick questions since I'm not much of a VB guy!
Do you know what the format of the text file needs to be? Comma-delimmited?
For example, should it be:
computer1, 10:45
computer2, 9:30
computer3, 13:00
etc....
Also, do you know where in the code to change how often the program checks
the text file? Could find it.
Thanks again for all your help!!!
P.S. I'm a big fan of sleep myself!! haha
"Umesh Thakur" wrote:
> 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: Umesh Thakur
- RE: Reboot Script for Group Policy?
- References:
- RE: Reboot Script for Group Policy?
- From: Umesh Thakur
- RE: Reboot Script for Group Policy?
- Prev by Date: Re: [MSH] Here-string bug?
- Next by Date: Re: Change logon script property for all users under a OU
- Previous by thread: RE: Reboot Script for Group Policy?
- Next by thread: RE: Reboot Script for Group Policy?
- Index(es):
Relevant Pages
|