Hi, I have the following script, the question is, i would like to add
2 things to this script but am not sure how to.

1) Create a log file for this that will show "username" and say "time"
and "date" it was ran.
2) Rarther than the machine name hard coded in the script allow a pop
up box so the user enters the machine name manually?

strComputer = "atl-dc-01"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & _
strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Reboot()
Next

Re: Restart machine script help by mr_unreliable

mr_unreliable
Thu Jul 19 11:20:50 CDT 2007

hi SystemTek,

If you don't mind using your system's existing log file,
you can use (wshShell) "LogEvent" Method to log your username
and date info. You can read about LogEvent in the scripting
documentation.

As to using a "popup box" to ask the user to input something,
the scripting "InputBox" is available for that. You can learn
about the InputBox function by reading your scripting
documentation.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)


systemtek wrote:
> Hi, I have the following script, the question is, i would like to add
> 2 things to this script but am not sure how to.
>
> 1) Create a log file for this that will show "username" and say "time"
> and "date" it was ran.
> 2) Rarther than the machine name hard coded in the script allow a pop
> up box so the user enters the machine name manually?
>
> strComputer = "atl-dc-01"
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate,(Shutdown)}!\\" & _
> strComputer & "\root\cimv2")
>
> Set colOperatingSystems = objWMIService.ExecQuery _
> ("Select * from Win32_OperatingSystem")
>
> For Each objOperatingSystem in colOperatingSystems
> objOperatingSystem.Reboot()
> Next
>