RE: Reboot Script for Group Policy?



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!!
.



Relevant Pages

  • Re: WMI and Joining Domain (sysprep related)
    ... > Just keep in mind that you have to rename the computer and reboot before you ... > use a script to automaticaly generate a sysprep.inf file that includes ... Dim sps_barcode,Flag,ExtraMsg ... '' Get workstation BIOS info for oeminfo '' ...
    (microsoft.public.scripting.vbscript)
  • RE: make world : did it fail?
    ... I know from the script output that the buildworld and buildkernel succeeded. ... The only step that is suspect is the installkernel. ... It reported the unpatched kernel. ... When I heard the computer reboot (it's sitting ...
    (freebsd-questions)
  • RE: Reboot Script for Group Policy?
    ... "Umesh Thakur" wrote: ... > I have a script that I use to reboot remote computers. ... to reboot those machines using those accounts. ...
    (microsoft.public.windows.server.scripting)
  • RE: Reboot Script for Group Policy?
    ... Thanks for the reply and modification you made to the script you provided. ... Machines Names/IP and time should be separated by ... > 'Script to REBOOT a machine remotely... ... >>> I have a script that I use to reboot remote computers. ...
    (microsoft.public.windows.server.scripting)
  • RE: Reboot Script for Group Policy?
    ... For your convenience, I have modified the script I sent you earlier, In this ... Machines Names/IP and time should be separated by ... 'Script to REBOOT a machine remotely... ... make sure that all computers have reboot times mentioned." ...
    (microsoft.public.windows.server.scripting)