locked
Using APC Powerchute Network Shutdown RRS feed

  • Question

  • Is there a way to add-on APC Powerchute Network Shutdown into my Windows Home Server? I want to shutdown my whole network when my Smart-UPS detects a power failure.

    I can get software from APC to load on my Windows and Mac machines, but what do I do to add this Windows Home Server?

     

    Thanks,

    Dom

    Wednesday, July 14, 2010 10:26 PM

All replies

  • APC doesn't have a Windows Home Server add-in version of their software, so you would need to log in to your server's desktop either through a physical console or via Remote Desktop. Be cautious; doing so is technically unsupported (as is installation of software from the desktop) so there are tools that could cause a variety of issues withy your server available there.
    I'm not on the WHS team, I just post a lot. :)
    Thursday, July 15, 2010 12:33 AM
    Moderator
  •  On 7/14/2010 5:26 PM, Dom Cassone wrote:

    Is there a way to add-on APC Powerchute Network Shutdown into my Windows Home Server? I want to shutdown my whole network when my Smart-UPS detects a power failure.

    I can get software from APC to load on my Windows and Mac machines, but what do I do to add this Windows Home Server?



    Thanks,

    Dom

    The closest that you'll get is GridJunction and their Action Scripts.  You can get GridJunction from http://www.kentdome.com/gridjunction  And they can direct you to forums where you'll get help with setting up the action scripts.  One thing to note is that you'll have to allow LAN access to RPC.

    Here is an example of the script (although I won't guarantee that this would work because I haven't tried it at all on my network) which is tweaked from my current script.

    '
    ' LOGOFF/REBOOT/SHUTDOWN REMOTE PC
    '********************************
    'Author: Alexander Kent
    'Date: 12/30/20008
    'Email: akent AT kentdome DOT com
    'Web: http://www.kentdome.com
    '
    'Use this script as an example how to logoff,
    'restart or shutdown a remote PC computer.
    'DO NOT RUN this shutdown code against another
    'Windows Home Sever!
    '
    'User credentials must have permissions to the WMI database,
    'and of course to be able to reboot the station.
    '
    'References: http://msdn.microsoft.com/en-us/library/9bbdkx3k(VS.85).aspx
    '
    '
    Dim strComputer, OperationMode, strUsername, strPassword

    'Remote computername or IP
    strComputer="192.168.x.x"

    'Specify the OperationMode (0 = Restart, 1 = Logoff, 2 = Shutdown)
    OperationMode = 2

    'Credentials
    strUsername = "username"
    strPassword = "password-unencrypted"

    'put computername into uppercase
    strComputer = UCase(strComputer)

    'Perform the operation on remote PC
    Call OperationAction
    strComputer="192.168.x.x" 'x.x is the next IP Address in your network
    strComputer=UCase(strComputer)
    Call OperationAction
    'Repeat the previous three steps for every computer in your network.

    Sub OperationAction
        On Error GoTo 0
        Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
     Set objSWbemServices = objSWbemLocator.ConnectServer _
          (strComputer, "root\cimv2", strUsername, strPassword)
     objSWbemServices.Security_.ImpersonationLevel = 3

    'Call WMI query to collect parameters for reboot action
        'Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//"_
         '& strComputer & "/root/cimv2").ExecQuery("select * from Win32_OperatingSystem"_
         '& " where Primary=true")

    Set OpSysSet = objSWbemServices.ExecQuery("select * from Win32_OperatingSystem"_
    & " where Primary=true")

    Dim OpSysSet, OpSys

    'Set PC to reboot
    If OperationMode = 0 Then
            For each OpSys in OpSysSet
                opSys.Reboot()
            Next

    'Set PC to logoff
    ElseIf OperationMode = 1 Then
             Const EWX_LOGOFF = 0
            For each OpSys in OpSysSet
                opSys.win32shutdown EWX_LOGOFF
            Next

    'Set PC to shutdown
    ElseIf OperationMode = 2 Then
            For each OpSys in OpSysSet
                opSys.Shutdown()
            Next
         End If
    End Sub
    '
    ' THIS IS THE END OF THE SCRIPT
    '

    In my situation (at least when I generated the script) it wouldn't accept the computer name as strComputer, so I had to put the IP Address in.  However, you should be able to pass the computer name in strComputer (you may have to precede it with \\, but I'm not sure).

    You'll want to repeat these steps for every computer in the network

    strComputer="192.168.x.x"
    strComputer=UCase(strComputer)
    Call OperationAction

    replacing x.x with the appropriate IP Address.  Again, I haven't tried this with my network, so I don't know how well (if at all) it will work.

    Hope this helps, and have a great day:)
    Patrick.


    Smile... Someone out there cares deeply for you.
    Have you updated today?
    http://update.microsoft.com


    Smile.. Someone out there cares deeply for you.
    Thursday, July 15, 2010 3:23 PM