GlennHayes
Thu May 08 14:16:01 PDT 2008
Good Idea just having compile errors with the script arount the Set OpSysSet
= GetObject("winmgmts:{(Shutdown)}\\" _ line.
Working my way throough the script to see if can make it work.
--
Glenn Hayes
"Paul Bergson [MVP-DS]" wrote:
> Have had issues such as this in the past on our Dell's (Don't think it is
> Dell related though). We would issue remote shutdown commands and sometimes
> the system wouldn't completely shutdown and it went into the undead state.
> Anyone connected to the machine still worked but no new connections allowed
> and no access to the console. Found out from Microsoft the shutdown command
> isn't the greatest and so I wrote a VBScript that has resolved the issue.
>
> This isn't the greatest code in the world, I should correct it so the values
> are all defined in the variables section but use it if you find value to it.
>
>
> Option Explicit
>
> ''''''''''''''''''''''''''''''''''''''''''''''''''
>
> ' Program - RemoteReboot.vbs '
>
> ' Author - Paul Bergson '
>
> ' Date Written - 08/15/07 '
>
> ' Description - Is a more drastic remote reboot '
>
> ''''''''''''''''''''''''''''''''''''''''''''''''''
>
> Dim OpSysSet
>
> Dim OpSys
>
> Dim strComputer
>
> Dim iMsg
>
> Dim iConf
>
> Dim Flds
>
> Dim strSubject
>
> Dim strHTML
>
> on error resume next
>
> strComputer = WScript.Arguments.Item(0) 'Get server name
>
> If WScript.Arguments.Count = 1 Then
>
> Set OpSysSet = GetObject("winmgmts:{(Shutdown)}\\" _
>
> & strComputer _
>
> & "\root\cimv2").ExecQuery("select * from Win32_OperatingSystem where
> Primary=true")
>
> For Each OpSys in OpSysSet
>
> OpSys.Reboot()
>
> Next
>
> Else
>
> Wscript.Echo "Server Name required. Reboot operation Aborted!"
>
> Wscript.Quit
>
> End If
>
>
> 'Send out an e-mail on the reboot
>
> set imsg = createobject("cdo.message")
>
> set iconf = createobject("cdo.configuration")
>
> Set Flds = iConf.Fields
>
> With Flds
>
> ..Item("
http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
>
> ..Item("
http://schemas.microsoft.com/cdo/configuration/smtpserver") =
> "Yoursmtp.YourDomain.com"
>
> ..Update
>
> End With
>
> strHTML = strComputer & " has been automatically rebooted by YourServerName"
> _
>
> & " on " & FormatDateTime(Date(),1) & ", " & FormatDateTime(Time(),3)
>
> strSubject = strComputer & " has been rebooted"
>
> With iMsg
>
> Set .Configuration = iConf
>
> ..To = "Notification Email@YourDomain.com" ' Destination e-mail address
>
> ..From = "ServerName@YourDomain.com"
>
> ..Subject = strSubject
>
> ..HTMLBody = strHTML
>
> ..Send
>
> End With
>
> set imsg = Nothing
>
> set iconf = Nothing
>
>
> --
> Paul Bergson
> MVP - Directory Services
> MCTS, MCT, MCSE, MCSA, Security+, BS CSci
> 2008, 2003, 2000 (Early Achiever), NT4
>
>
http://www.pbbergs.com
>
> Please no e-mails, any questions should be posted in the NewsGroup
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Glenn Hayes" <GlennHayes@discussions.microsoft.com> wrote in message
> news:C2A1A98A-CD52-443B-B7BE-422EAA5225C1@microsoft.com...
> > W2k3 R2 sp2 will not respond to a log off or shutdown command. Nothing
> > unusual logged in the event log. Removed APC UPS software to eliminate
> > that
> > possiblity. Can't seem to find anything that is not right but it is slow
> > to
> > respond and no response on shutdown, restart or logoff. Server is a Dell
> > 2850
> > Dual proc server.
> > --
> > Glenn Hayes
>
>
>