Announcement

Collapse
No announcement yet.

Win2000 Shutdown Problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Win2000 Shutdown Problem

    When i use the "Shutdown" function in Hyena on a win200 client, the pc can not turn himself off (he stays at the "It is Now Safe to Turn Off Your Computer" -message).

    how can i solve this problem?

  • #2
    Re: Win2000 Shutdown Problem

    Unfortunately Microsoft does not support (or at least does not produce a documented interface/API for) remotely powering down a computer.

    Comment


    • #3
      Re: Win2000 Shutdown Problem

      copy the following and save it as a vbs file. Start here>>>>>
      Dim oArg
      Dim OS
      Dim Proc
      Dim ErrorOccurred

      Set oArgs = WScript.Arguments

      If oArgs.Count = 0 Then
      WScript.Echo "************************************************* ********" & vbCRLF & _
      "You must specify a computer name to shutdown (Power Off)."
      WScript.Quit
      End If

      On Error Resume Next
      Set OS = GetObject("WINMGMTS://" & oArgs(0) & "/ROOT/CIMV2").ExecQuery("SELECT * FROM Win32_OperatingSystem WHERE Primary=True")

      If Err.Number <> 0 Then
      WScript.Echo "Error " & Err.Number & " - " & Err.Description
      WScript.Quit
      End If

      ErrorOccurred = False
      On Error Resume Next

      For Each Proc In OS
      On Error Resume Next
      Proc.Win32Shutdown 12

      If Err.Number <> 0 Then
      ErrorOccurred = True
      End If
      Next

      If ErrorOccurred Then
      WScript.Echo "************************************************* ********" & vbCRLF & _
      "ERROR! Computer '" & oArgs(0) & "' may not have shutdown properly."
      Else
      WScript.Echo "************************************************* ********" & vbCRLF & _
      "Computer '" & oArgs(0) & "' was shutdown."
      End If

      Set OS = Nothing
      WScript.Quit
      <<<<<<Stop here. Now you have to have wsh 5.6 installed on the machine running this script. Here's the command to put in your tools of hyena. cscript yourname.vbs "computer-name" without the quotes though. I have a different version that will use a dat file and power off every machine listed in the DAT file.


      [This message has been edited by Trammel (edited 11-06-2003).]

      Comment


      • #4
        Re: Win2000 Shutdown Problem

        thanx, it works!
        nice hint!

        i'm very interested in the dat-version too ;-)

        Comment

        Working...
        X
        😀
        🥰
        🤢
        😎
        😡
        👍
        👎