Announcement

Collapse
No announcement yet.

Shutting down multiple servers from SBS 2011 with UPS shutdown script

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

  • Shutting down multiple servers from SBS 2011 with UPS shutdown script

    Hi All,

    I have the following script that doesn't work. It's called "turn_off_all_servers.bat" and is executed from the Dell UPS Local Node Manager on power failure. The problem is the following: I can run each line from a console window and successfully turn off each machine (the last one is SBS 2011 itself) but it does not work as a whole script.

    Does anybody know the reason why it happens?

    Code:
    shutdown -s -t 60 -c "UPS shutdown" -m \\backup
    shutdown -s -t 60 -c "UPS shutdown" -m \\tfs1
    shutdown -s -t 60 -c "UPS shutdown"
    REM never call this file shutdown.bat otherwise the second call with call the batch file itself
    When I click "Test shutdown" button on the Dell UPS Local node manager only the local machine is turned off, not the others. Does the order of calls matter?

    Thanks,

    Alberto

  • #2
    Re: Shutting down multiple servers from SBS 2011 with UPS shutdown script

    Does the syntax order matter? When I run shutdown /? on my Win7 machine it shows the following:

    Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f]
    [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

    Which is a different syntax order to that which you have above.
    A recent poll suggests that 6 out of 7 dwarfs are not happy

    Comment


    • #3
      Re: Shutting down multiple servers from SBS 2011 with UPS shutdown script

      Hi Blood,

      I thought about it but running each line by itself in a console window I can turn off each machine... When I run the whole batch file only the last is affected...

      What do you think?

      Alberto

      Comment


      • #4
        Re: Shutting down multiple servers from SBS 2011 with UPS shutdown script

        Have you tried running:

        turn_off_all_servers > UPS-SD.txt

        to see it captures any error messages?
        A recent poll suggests that 6 out of 7 dwarfs are not happy

        Comment


        • #5
          Re: Shutting down multiple servers from SBS 2011 with UPS shutdown script

          Will this execute the commands as well? I cannot turn off mail server in the middle of the week...

          Comment


          • #6
            Re: Shutting down multiple servers from SBS 2011 with UPS shutdown script

            Sorry - yes, it will.

            Run it out-of-hours.

            However, when testing were you running it from a command prompt? If so, any errors would have been displayed.
            A recent poll suggests that 6 out of 7 dwarfs are not happy

            Comment


            • #7
              Re: Shutting down multiple servers from SBS 2011 with UPS shutdown script

              Are you running this script with domain admin credentials? I suspect it's failing because the account this is run under doesn't have permission to remotely shutdown the other servers.
              If you put a pause at the end of this script and try to run it does it say 'Access denied'?
              Please remember to award reputation points if you have received good advice.
              I do tend to think 'outside the box' so others may not always share the same views.

              MCITP -W7,
              MCSA+Messaging, CCENT, ICND2 slowly getting around to.

              Comment


              • #8
                Re: Shutting down multiple servers from SBS 2011 with UPS shutdown script

                Will do it over the week-end and let you know, thanks for the help provided so far Blood.

                Comment


                • #9
                  Re: Shutting down multiple servers from SBS 2011 with UPS shutdown script

                  Hi Blood,

                  Here is the result of calling: "turn_off_all_servers > UPS-SD.txt"

                  Code:
                   
                   C:\>shutdown -s -t 60 -c "UPS shutdown" -m \\backup 
                   C:\>shutdown -s -t 60 -c "UPS shutdown" -m \\tfs1 
                   C:\>shutdown -s -t 60 -c "UPS shutdown" 
                   C:\>REM never call this file shutdown.bat otherwise the second call with call the batch file itself
                  And all machines turned off automatically with the "UPS shutdown" message in the 1074 event.

                  Next week-end I will try to unplug the complete Rack enclosure as a final test.

                  Thanks for the help provided so far.

                  Alberto

                  Comment


                  • #10
                    Re: Shutting down multiple servers from SBS 2011 with UPS shutdown script

                    No, unplugging the power socket the problem remains (machines die because of lack of power) and clicking 'test shutdown from the DELL UPS Local Node manager software' only properly shuts down the local machine not the others.

                    At this point I have a batch file that works and a tool that is unable to run it properly.

                    I already called DELL for this matter and they where unable to assist me.

                    I will call again. In the meantime any other idea is welcome.

                    Thanks again,

                    Alberto

                    Comment


                    • #11
                      Re: Shutting down multiple servers from SBS 2011 with UPS shutdown script

                      Have you seen this article:

                      http://network-shutdown.com/remotely...ers-on-network

                      It says that different versions of Windows can have slightly different syntax options.
                      A recent poll suggests that 6 out of 7 dwarfs are not happy

                      Comment


                      • #12
                        Re: Shutting down multiple servers from SBS 2011 with UPS shutdown script

                        if I run the batch file alone from a command prompt everything is executed properly. The batch file is fine.

                        Comment


                        • #13
                          Re: Shutting down multiple servers from SBS 2011 with UPS shutdown script

                          Have you considered using the Sysinternals tool? It's quite obvious that we're missing something regarding using Shutdown in a batch file, so it may actually save you time if you tried psshutdown instead. If that works then you can try and discover why shutdown.exe was not working in a more leisurely fashion.
                          A recent poll suggests that 6 out of 7 dwarfs are not happy

                          Comment


                          • #14
                            Re: Shutting down multiple servers from SBS 2011 with UPS shutdown script

                            I think uk_network was onto something in his earlier post.

                            The question is: which user (account) is executing the script? If the UPS manager is running under a local account (as most services do), that account won't have the necessary permissions to shut down other systems.

                            The script is probably being run as the service account used to run the Dell UPS manager, but you can easily verify this by having the UPS manager run a script containing the command
                            Code:
                            whoami > file.txt
                            and check the contents of the file afterwards.

                            If the account running the script has insufficient permissions, you can either add a net use \\<server>\ipc$ <password> /USER:<account> command immediately prior to each shutdown command, or you could change the account settings for the UPS service.

                            Comment


                            • #15
                              Re: Shutting down multiple servers from SBS 2011 with UPS shutdown script

                              This really make sense to me, I will try immediately a batch file containing

                              Code:
                              whoami > file.txt
                              Thanks Ser!

                              Comment

                              Working...
                              X