Guest Haggis Posted October 17, 2008 Posted October 17, 2008 I have an odd issue. the scenario is this. i have a server (A) connected to a UPS that is set to run a batch file when the battery power gets to some predetermined level. THis batch file is a remote shutdown command to bring down the another server (B) connected to the UPS. As part of the test i send a command line email before and after the remote shutdown command so that i know that it has run. Now the remote shutdown command runs properly when i test it on the Server (A) and both emails are sent. When i test it on the UPS, the emails are sent but the remote shutdown command fails. I cannot understand why, it is obvious that the command is running but as the emails fire, but no remote shutdown. Any ideas? thanks in advance
Guest Pegasus \(MVP\) Posted October 17, 2008 Posted October 17, 2008 Re: remote Shutdown Command "Haggis" <Haggis@discussions.microsoft.com> wrote in message news:64905806-479B-4A43-BB8F-D851F902CAF0@microsoft.com... >I have an odd issue. the scenario is this. > i have a server (A) connected to a UPS that is set to run a batch file > when > the battery power gets to some predetermined level. THis batch file is a > remote shutdown command to bring down the another server (B) connected to > the > UPS. > > As part of the test i send a command line email before and after the > remote > shutdown command so that i know that it has run. Now the remote shutdown > command runs properly when i test it on the Server (A) and both emails are > sent. When i test it on the UPS, the emails are sent but the remote > shutdown > command fails. I cannot understand why, it is obvious that the command is > running but as the emails fire, but no remote shutdown. > > Any ideas? thanks in advance You need to report precisely how the whole concept hangs together. Presumably you use a batch file to send the EMail message and perform the shutdown. Let's have a look at the batch file and the shutdown command! Since there are numerous shutdown commands, you must report which one you use.
Guest Haggis Posted October 19, 2008 Posted October 19, 2008 Re: remote Shutdown Command I wouldn't have thought it would matter too much as the command semms to work but under slightly different conditions, anyway the syntax i am using is: call shutdown /s /f /m \\SERVERname "Pegasus (MVP)" wrote: > > "Haggis" <Haggis@discussions.microsoft.com> wrote in message > news:64905806-479B-4A43-BB8F-D851F902CAF0@microsoft.com... > >I have an odd issue. the scenario is this. > > i have a server (A) connected to a UPS that is set to run a batch file > > when > > the battery power gets to some predetermined level. THis batch file is a > > remote shutdown command to bring down the another server (B) connected to > > the > > UPS. > > > > As part of the test i send a command line email before and after the > > remote > > shutdown command so that i know that it has run. Now the remote shutdown > > command runs properly when i test it on the Server (A) and both emails are > > sent. When i test it on the UPS, the emails are sent but the remote > > shutdown > > command fails. I cannot understand why, it is obvious that the command is > > running but as the emails fire, but no remote shutdown. > > > > Any ideas? thanks in advance > > You need to report precisely how the whole concept hangs together. > Presumably you use a batch file to send the EMail message and perform the > shutdown. Let's have a look at the batch file and the shutdown command! > Since there are numerous shutdown commands, you must report which one you > use. > > >
Guest Pegasus \(MVP\) Posted October 19, 2008 Posted October 19, 2008 Re: remote Shutdown Command The syntax matters a great deal. Here it is for three different flavours of shutdown.exe: Flavour 1 ====== Usage: SHUTDOWN [/?] [\\Computer] [/L] [/A] [/R] [/T:xx] ["Msg"] [/Y] [/C] /? Shows this screen. \\Computer Specifies a remote computer to shutdown. /L Specifies a local shutdown. /A Abortes a systemshutdown. This is only possible during the timeout period.If this switch is used, all other are ignored. /R Specifies that the machine should reboot after shutdown. /T:xx Sets the timer for system shutdown in seconds.[20 sec. default] "Msg" Specifies an additional message /Y Answer all following questinons with yes /C Forces running applications to close. ATTENTION: If you use the /C parameter NT ignores the applications option to save data which may have canged. You will see no File-Save dialog box, because NT will force the application to close. This will result in a loss of all data. not previously saved !!! Flavour 2 ======= Usage: shutdown [-lkurhs] [-f] [-c] [-t sec] -l: Log Off. -u: Shutdown (Turn Off). -r: Restart. -h: Hibernate. -s: Stand By (Sleep). -f: Force the action. -c: Cancel a running shutdown. -t sec: Delay for number of seconds. Flavour 3 ====== Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "c omment"] [-d up:xx:yy] No args Display this message (same as -?) -i Display GUI interface, must be the first option -l Log off (cannot be used with -m option) -s Shutdown the computer -r Shutdown and restart the computer -a Abort a system shutdown -m \\computername Remote computer to shutdown/restart/abort -t xx Set timeout for shutdown to xx seconds -c "comment" Shutdown comment (maximum of 127 characters) -f Forces running applications to close without warning -d [p]:xx:yy The reason code for the shutdown u is the user code p is a planned shutdown code xx is the major reason code (positive integer less than 256) yy is the minor reason code (positive integer less than 65536) Note that some flavours use slashes for the switches and others use dashes. I suspect that you have two flavours on your machine, and since you do not specify a drive or a folder name, you can never be sure which version you execute. Specifying drive + folder is compulsory if you want your batch files to be robust. For good measure you should add a file extension too. You should also drop the "call" instruction. It serves no purpose here, unless you're calling a batch file called "shutdown.bat" (which I hope you don't!). "Haggis" <Haggis@discussions.microsoft.com> wrote in message news:3CBC0921-0959-441C-AF22-86A664126190@microsoft.com... >I wouldn't have thought it would matter too much as the command semms to >work > but under slightly different conditions, anyway the syntax i am using is: > > call shutdown /s /f /m \\SERVERname > > "Pegasus (MVP)" wrote: > >> >> "Haggis" <Haggis@discussions.microsoft.com> wrote in message >> news:64905806-479B-4A43-BB8F-D851F902CAF0@microsoft.com... >> >I have an odd issue. the scenario is this. >> > i have a server (A) connected to a UPS that is set to run a batch file >> > when >> > the battery power gets to some predetermined level. THis batch file is >> > a >> > remote shutdown command to bring down the another server (B) connected >> > to >> > the >> > UPS. >> > >> > As part of the test i send a command line email before and after the >> > remote >> > shutdown command so that i know that it has run. Now the remote >> > shutdown >> > command runs properly when i test it on the Server (A) and both emails >> > are >> > sent. When i test it on the UPS, the emails are sent but the remote >> > shutdown >> > command fails. I cannot understand why, it is obvious that the command >> > is >> > running but as the emails fire, but no remote shutdown. >> > >> > Any ideas? thanks in advance >> >> You need to report precisely how the whole concept hangs together. >> Presumably you use a batch file to send the EMail message and perform the >> shutdown. Let's have a look at the batch file and the shutdown command! >> Since there are numerous shutdown commands, you must report which one you >> use. >> >> >>
Guest Haggis Posted October 20, 2008 Posted October 20, 2008 Re: remote Shutdown Command OK...i am getting slightly confused. Refering to different flavours and specifying drive and folder, does this mean that there are differnet shutdown files in a server installation? If so what are their different locations. If not, why use different flavour over another and do you recommend a specific one for what i am trying to do? "Pegasus (MVP)" wrote: > The syntax matters a great deal. Here it is for three different flavours of > shutdown.exe: > > Flavour 1 > ====== > Usage: SHUTDOWN [/?] [\\Computer] [/L] [/A] [/R] [/T:xx] ["Msg"] [/Y] [/C] > /? Shows this screen. > \\Computer Specifies a remote computer to shutdown. > /L Specifies a local shutdown. > /A Abortes a systemshutdown. This is only possible during the > timeout period.If this switch is used, all other are > ignored. > /R Specifies that the machine should reboot after shutdown. > /T:xx Sets the timer for system shutdown in seconds.[20 sec. > default] > "Msg" Specifies an additional message > /Y Answer all following questinons with yes > /C Forces running applications to close. > ATTENTION: If you use the /C parameter NT ignores the > applications option to save data which may > have canged. You will see no File-Save dialog > box, because NT will force the application to > close. This will result in a loss of all data. > not previously saved !!! > > Flavour 2 > ======= > Usage: shutdown [-lkurhs] [-f] [-c] [-t sec] > -l: Log Off. > -u: Shutdown (Turn Off). > -r: Restart. > -h: Hibernate. > -s: Stand By (Sleep). > -f: Force the action. > -c: Cancel a running shutdown. > -t sec: Delay for number of seconds. > > Flavour 3 > ====== > Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] > [-c "c > omment"] [-d up:xx:yy] > > No args Display this message (same as -?) > -i Display GUI interface, must be the first > option > -l Log off (cannot be used with -m option) > -s Shutdown the computer > -r Shutdown and restart the computer > -a Abort a system shutdown > -m \\computername Remote computer to shutdown/restart/abort > -t xx Set timeout for shutdown to xx seconds > -c "comment" Shutdown comment (maximum of 127 characters) > -f Forces running applications to close without > warning > -d [p]:xx:yy The reason code for the shutdown > u is the user code > p is a planned shutdown code > xx is the major reason code (positive > integer less than 256) > yy is the minor reason code (positive > integer less than 65536) > > Note that some flavours use slashes for the switches and others use dashes. > I suspect that you have two flavours on your machine, and since you do not > specify a drive or a folder name, you can never be sure which version you > execute. Specifying drive + folder is compulsory if you want your batch > files to be robust. For good measure you should add a file extension too. > > You should also drop the "call" instruction. It serves no purpose here, > unless you're calling a batch file called "shutdown.bat" (which I hope you > don't!). > > > "Haggis" <Haggis@discussions.microsoft.com> wrote in message > news:3CBC0921-0959-441C-AF22-86A664126190@microsoft.com... > >I wouldn't have thought it would matter too much as the command semms to > >work > > but under slightly different conditions, anyway the syntax i am using is: > > > > call shutdown /s /f /m \\SERVERname > > > > "Pegasus (MVP)" wrote: > > > >> > >> "Haggis" <Haggis@discussions.microsoft.com> wrote in message > >> news:64905806-479B-4A43-BB8F-D851F902CAF0@microsoft.com... > >> >I have an odd issue. the scenario is this. > >> > i have a server (A) connected to a UPS that is set to run a batch file > >> > when > >> > the battery power gets to some predetermined level. THis batch file is > >> > a > >> > remote shutdown command to bring down the another server (B) connected > >> > to > >> > the > >> > UPS. > >> > > >> > As part of the test i send a command line email before and after the > >> > remote > >> > shutdown command so that i know that it has run. Now the remote > >> > shutdown > >> > command runs properly when i test it on the Server (A) and both emails > >> > are > >> > sent. When i test it on the UPS, the emails are sent but the remote > >> > shutdown > >> > command fails. I cannot understand why, it is obvious that the command > >> > is > >> > running but as the emails fire, but no remote shutdown. > >> > > >> > Any ideas? thanks in advance > >> > >> You need to report precisely how the whole concept hangs together. > >> Presumably you use a batch file to send the EMail message and perform the > >> shutdown. Let's have a look at the batch file and the shutdown command! > >> Since there are numerous shutdown commands, you must report which one you > >> use. > >> > >> > >> > > >
Guest Pegasus \(MVP\) Posted October 20, 2008 Posted October 20, 2008 Re: remote Shutdown Command I don't know about Windows 2000 Server but Windows 2000 Professional did not have a native shutdown command. You had to download a third-party version. Where does your version reside? What is its syntax? What do you get when you type "shutdown /?" ? "Haggis" <Haggis@discussions.microsoft.com> wrote in message news:4E5BFA7C-0480-4372-BB43-12AC0A88CA21@microsoft.com... > OK...i am getting slightly confused. Refering to different flavours and > specifying drive and folder, does this mean that there are differnet > shutdown > files in a server installation? If so what are their different locations. > If > not, why use different flavour over another and do you recommend a > specific > one for what i am trying to do? > > "Pegasus (MVP)" wrote: > >> The syntax matters a great deal. Here it is for three different flavours >> of >> shutdown.exe: >> >> Flavour 1 >> ====== >> Usage: SHUTDOWN [/?] [\\Computer] [/L] [/A] [/R] [/T:xx] ["Msg"] [/Y] >> [/C] >> /? Shows this screen. >> \\Computer Specifies a remote computer to shutdown. >> /L Specifies a local shutdown. >> /A Abortes a systemshutdown. This is only possible during >> the >> timeout period.If this switch is used, all other are >> ignored. >> /R Specifies that the machine should reboot after shutdown. >> /T:xx Sets the timer for system shutdown in seconds.[20 sec. >> default] >> "Msg" Specifies an additional message >> /Y Answer all following questinons with yes >> /C Forces running applications to close. >> ATTENTION: If you use the /C parameter NT ignores the >> applications option to save data which may >> have canged. You will see no File-Save dialog >> box, because NT will force the application to >> close. This will result in a loss of all data. >> not previously saved !!! >> >> Flavour 2 >> ======= >> Usage: shutdown [-lkurhs] [-f] [-c] [-t sec] >> -l: Log Off. >> -u: Shutdown (Turn Off). >> -r: Restart. >> -h: Hibernate. >> -s: Stand By (Sleep). >> -f: Force the action. >> -c: Cancel a running shutdown. >> -t sec: Delay for number of seconds. >> >> Flavour 3 >> ====== >> Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] >> [-c "c >> omment"] [-d up:xx:yy] >> >> No args Display this message (same as -?) >> -i Display GUI interface, must be the first >> option >> -l Log off (cannot be used with -m option) >> -s Shutdown the computer >> -r Shutdown and restart the computer >> -a Abort a system shutdown >> -m \\computername Remote computer to shutdown/restart/abort >> -t xx Set timeout for shutdown to xx seconds >> -c "comment" Shutdown comment (maximum of 127 >> characters) >> -f Forces running applications to close >> without >> warning >> -d [p]:xx:yy The reason code for the shutdown >> u is the user code >> p is a planned shutdown code >> xx is the major reason code (positive >> integer less than 256) >> yy is the minor reason code (positive >> integer less than 65536) >> >> Note that some flavours use slashes for the switches and others use >> dashes. >> I suspect that you have two flavours on your machine, and since you do >> not >> specify a drive or a folder name, you can never be sure which version you >> execute. Specifying drive + folder is compulsory if you want your batch >> files to be robust. For good measure you should add a file extension too. >> >> You should also drop the "call" instruction. It serves no purpose here, >> unless you're calling a batch file called "shutdown.bat" (which I hope >> you >> don't!). >> >> >> "Haggis" <Haggis@discussions.microsoft.com> wrote in message >> news:3CBC0921-0959-441C-AF22-86A664126190@microsoft.com... >> >I wouldn't have thought it would matter too much as the command semms to >> >work >> > but under slightly different conditions, anyway the syntax i am using >> > is: >> > >> > call shutdown /s /f /m \\SERVERname >> > >> > "Pegasus (MVP)" wrote: >> > >> >> >> >> "Haggis" <Haggis@discussions.microsoft.com> wrote in message >> >> news:64905806-479B-4A43-BB8F-D851F902CAF0@microsoft.com... >> >> >I have an odd issue. the scenario is this. >> >> > i have a server (A) connected to a UPS that is set to run a batch >> >> > file >> >> > when >> >> > the battery power gets to some predetermined level. THis batch file >> >> > is >> >> > a >> >> > remote shutdown command to bring down the another server (B) >> >> > connected >> >> > to >> >> > the >> >> > UPS. >> >> > >> >> > As part of the test i send a command line email before and after the >> >> > remote >> >> > shutdown command so that i know that it has run. Now the remote >> >> > shutdown >> >> > command runs properly when i test it on the Server (A) and both >> >> > emails >> >> > are >> >> > sent. When i test it on the UPS, the emails are sent but the remote >> >> > shutdown >> >> > command fails. I cannot understand why, it is obvious that the >> >> > command >> >> > is >> >> > running but as the emails fire, but no remote shutdown. >> >> > >> >> > Any ideas? thanks in advance >> >> >> >> You need to report precisely how the whole concept hangs together. >> >> Presumably you use a batch file to send the EMail message and perform >> >> the >> >> shutdown. Let's have a look at the batch file and the shutdown >> >> command! >> >> Since there are numerous shutdown commands, you must report which one >> >> you >> >> use. >> >> >> >> >> >> >> >> >>
Guest Haggis Posted October 20, 2008 Posted October 20, 2008 Re: remote Shutdown Command Usage: shutdown [/i | /l | /s | /r | /a | /p | /h | /e] [/f] [/m \\computer][/t xxx][/d [p:]xx:yy [/c "comment"]] "Pegasus (MVP)" wrote: > I don't know about Windows 2000 Server but Windows 2000 Professional did not > have a native shutdown command. You had to download a third-party version. > Where does your version reside? What is its syntax? What do you get when you > type "shutdown /?" ? > > > "Haggis" <Haggis@discussions.microsoft.com> wrote in message > news:4E5BFA7C-0480-4372-BB43-12AC0A88CA21@microsoft.com... > > OK...i am getting slightly confused. Refering to different flavours and > > specifying drive and folder, does this mean that there are differnet > > shutdown > > files in a server installation? If so what are their different locations. > > If > > not, why use different flavour over another and do you recommend a > > specific > > one for what i am trying to do? > > > > "Pegasus (MVP)" wrote: > > > >> The syntax matters a great deal. Here it is for three different flavours > >> of > >> shutdown.exe: > >> > >> Flavour 1 > >> ====== > >> Usage: SHUTDOWN [/?] [\\Computer] [/L] [/A] [/R] [/T:xx] ["Msg"] [/Y] > >> [/C] > >> /? Shows this screen. > >> \\Computer Specifies a remote computer to shutdown. > >> /L Specifies a local shutdown. > >> /A Abortes a systemshutdown. This is only possible during > >> the > >> timeout period.If this switch is used, all other are > >> ignored. > >> /R Specifies that the machine should reboot after shutdown. > >> /T:xx Sets the timer for system shutdown in seconds.[20 sec. > >> default] > >> "Msg" Specifies an additional message > >> /Y Answer all following questinons with yes > >> /C Forces running applications to close. > >> ATTENTION: If you use the /C parameter NT ignores the > >> applications option to save data which may > >> have canged. You will see no File-Save dialog > >> box, because NT will force the application to > >> close. This will result in a loss of all data. > >> not previously saved !!! > >> > >> Flavour 2 > >> ======= > >> Usage: shutdown [-lkurhs] [-f] [-c] [-t sec] > >> -l: Log Off. > >> -u: Shutdown (Turn Off). > >> -r: Restart. > >> -h: Hibernate. > >> -s: Stand By (Sleep). > >> -f: Force the action. > >> -c: Cancel a running shutdown. > >> -t sec: Delay for number of seconds. > >> > >> Flavour 3 > >> ====== > >> Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] > >> [-c "c > >> omment"] [-d up:xx:yy] > >> > >> No args Display this message (same as -?) > >> -i Display GUI interface, must be the first > >> option > >> -l Log off (cannot be used with -m option) > >> -s Shutdown the computer > >> -r Shutdown and restart the computer > >> -a Abort a system shutdown > >> -m \\computername Remote computer to shutdown/restart/abort > >> -t xx Set timeout for shutdown to xx seconds > >> -c "comment" Shutdown comment (maximum of 127 > >> characters) > >> -f Forces running applications to close > >> without > >> warning > >> -d [p]:xx:yy The reason code for the shutdown > >> u is the user code > >> p is a planned shutdown code > >> xx is the major reason code (positive > >> integer less than 256) > >> yy is the minor reason code (positive > >> integer less than 65536) > >> > >> Note that some flavours use slashes for the switches and others use > >> dashes. > >> I suspect that you have two flavours on your machine, and since you do > >> not > >> specify a drive or a folder name, you can never be sure which version you > >> execute. Specifying drive + folder is compulsory if you want your batch > >> files to be robust. For good measure you should add a file extension too. > >> > >> You should also drop the "call" instruction. It serves no purpose here, > >> unless you're calling a batch file called "shutdown.bat" (which I hope > >> you > >> don't!). > >> > >> > >> "Haggis" <Haggis@discussions.microsoft.com> wrote in message > >> news:3CBC0921-0959-441C-AF22-86A664126190@microsoft.com... > >> >I wouldn't have thought it would matter too much as the command semms to > >> >work > >> > but under slightly different conditions, anyway the syntax i am using > >> > is: > >> > > >> > call shutdown /s /f /m \\SERVERname > >> > > >> > "Pegasus (MVP)" wrote: > >> > > >> >> > >> >> "Haggis" <Haggis@discussions.microsoft.com> wrote in message > >> >> news:64905806-479B-4A43-BB8F-D851F902CAF0@microsoft.com... > >> >> >I have an odd issue. the scenario is this. > >> >> > i have a server (A) connected to a UPS that is set to run a batch > >> >> > file > >> >> > when > >> >> > the battery power gets to some predetermined level. THis batch file > >> >> > is > >> >> > a > >> >> > remote shutdown command to bring down the another server (B) > >> >> > connected > >> >> > to > >> >> > the > >> >> > UPS. > >> >> > > >> >> > As part of the test i send a command line email before and after the > >> >> > remote > >> >> > shutdown command so that i know that it has run. Now the remote > >> >> > shutdown > >> >> > command runs properly when i test it on the Server (A) and both > >> >> > emails > >> >> > are > >> >> > sent. When i test it on the UPS, the emails are sent but the remote > >> >> > shutdown > >> >> > command fails. I cannot understand why, it is obvious that the > >> >> > command > >> >> > is > >> >> > running but as the emails fire, but no remote shutdown. > >> >> > > >> >> > Any ideas? thanks in advance > >> >> > >> >> You need to report precisely how the whole concept hangs together. > >> >> Presumably you use a batch file to send the EMail message and perform > >> >> the > >> >> shutdown. Let's have a look at the batch file and the shutdown > >> >> command! > >> >> Since there are numerous shutdown commands, you must report which one > >> >> you > >> >> use. > >> >> > >> >> > >> >> > >> > >> > >> > > >
Guest Pegasus \(MVP\) Posted October 20, 2008 Posted October 20, 2008 Re: remote Shutdown Command The flavour you use is different again from the three flavours I previously quoted. Where does the command reside? Did you include the full drive+path when invoking it? Instead of just running shutdown, run this file: @echo off echo %date% %time% %UserName% >> c:\test.log "c:\Some Folder\shutdown.exe /.. /.. 1>>c:\test.log 2>>&1 echo %date% %time% >> c:\test.log What is the contents of c:\test.log when the command fails? "Haggis" <Haggis@discussions.microsoft.com> wrote in message news:78E8BBFE-E306-4655-9326-9EB0A6CC8771@microsoft.com... > Usage: shutdown [/i | /l | /s | /r | /a | /p | /h | /e] [/f] > [/m \\computer][/t xxx][/d [p:]xx:yy [/c "comment"]] > > "Pegasus (MVP)" wrote: > >> I don't know about Windows 2000 Server but Windows 2000 Professional did >> not >> have a native shutdown command. You had to download a third-party >> version. >> Where does your version reside? What is its syntax? What do you get when >> you >> type "shutdown /?" ? >> >> >> "Haggis" <Haggis@discussions.microsoft.com> wrote in message >> news:4E5BFA7C-0480-4372-BB43-12AC0A88CA21@microsoft.com... >> > OK...i am getting slightly confused. Refering to different flavours and >> > specifying drive and folder, does this mean that there are differnet >> > shutdown >> > files in a server installation? If so what are their different >> > locations. >> > If >> > not, why use different flavour over another and do you recommend a >> > specific >> > one for what i am trying to do? >> > >> > "Pegasus (MVP)" wrote: >> > >> >> The syntax matters a great deal. Here it is for three different >> >> flavours >> >> of >> >> shutdown.exe: >> >> >> >> Flavour 1 >> >> ====== >> >> Usage: SHUTDOWN [/?] [\\Computer] [/L] [/A] [/R] [/T:xx] ["Msg"] [/Y] >> >> [/C] >> >> /? Shows this screen. >> >> \\Computer Specifies a remote computer to shutdown. >> >> /L Specifies a local shutdown. >> >> /A Abortes a systemshutdown. This is only possible during >> >> the >> >> timeout period.If this switch is used, all other are >> >> ignored. >> >> /R Specifies that the machine should reboot after >> >> shutdown. >> >> /T:xx Sets the timer for system shutdown in seconds.[20 sec. >> >> default] >> >> "Msg" Specifies an additional message >> >> /Y Answer all following questinons with yes >> >> /C Forces running applications to close. >> >> ATTENTION: If you use the /C parameter NT ignores the >> >> applications option to save data which may >> >> have canged. You will see no File-Save >> >> dialog >> >> box, because NT will force the application >> >> to >> >> close. This will result in a loss of all >> >> data. >> >> not previously saved !!! >> >> >> >> Flavour 2 >> >> ======= >> >> Usage: shutdown [-lkurhs] [-f] [-c] [-t sec] >> >> -l: Log Off. >> >> -u: Shutdown (Turn Off). >> >> -r: Restart. >> >> -h: Hibernate. >> >> -s: Stand By (Sleep). >> >> -f: Force the action. >> >> -c: Cancel a running shutdown. >> >> -t sec: Delay for number of seconds. >> >> >> >> Flavour 3 >> >> ====== >> >> Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t >> >> xx] >> >> [-c "c >> >> omment"] [-d up:xx:yy] >> >> >> >> No args Display this message (same as -?) >> >> -i Display GUI interface, must be the >> >> first >> >> option >> >> -l Log off (cannot be used with -m >> >> option) >> >> -s Shutdown the computer >> >> -r Shutdown and restart the computer >> >> -a Abort a system shutdown >> >> -m \\computername Remote computer to >> >> shutdown/restart/abort >> >> -t xx Set timeout for shutdown to xx seconds >> >> -c "comment" Shutdown comment (maximum of 127 >> >> characters) >> >> -f Forces running applications to close >> >> without >> >> warning >> >> -d [p]:xx:yy The reason code for the shutdown >> >> u is the user code >> >> p is a planned shutdown code >> >> xx is the major reason code (positive >> >> integer less than 256) >> >> yy is the minor reason code (positive >> >> integer less than 65536) >> >> >> >> Note that some flavours use slashes for the switches and others use >> >> dashes. >> >> I suspect that you have two flavours on your machine, and since you do >> >> not >> >> specify a drive or a folder name, you can never be sure which version >> >> you >> >> execute. Specifying drive + folder is compulsory if you want your >> >> batch >> >> files to be robust. For good measure you should add a file extension >> >> too. >> >> >> >> You should also drop the "call" instruction. It serves no purpose >> >> here, >> >> unless you're calling a batch file called "shutdown.bat" (which I hope >> >> you >> >> don't!). >> >> >> >> >> >> "Haggis" <Haggis@discussions.microsoft.com> wrote in message >> >> news:3CBC0921-0959-441C-AF22-86A664126190@microsoft.com... >> >> >I wouldn't have thought it would matter too much as the command semms >> >> >to >> >> >work >> >> > but under slightly different conditions, anyway the syntax i am >> >> > using >> >> > is: >> >> > >> >> > call shutdown /s /f /m \\SERVERname >> >> > >> >> > "Pegasus (MVP)" wrote: >> >> > >> >> >> >> >> >> "Haggis" <Haggis@discussions.microsoft.com> wrote in message >> >> >> news:64905806-479B-4A43-BB8F-D851F902CAF0@microsoft.com... >> >> >> >I have an odd issue. the scenario is this. >> >> >> > i have a server (A) connected to a UPS that is set to run a batch >> >> >> > file >> >> >> > when >> >> >> > the battery power gets to some predetermined level. THis batch >> >> >> > file >> >> >> > is >> >> >> > a >> >> >> > remote shutdown command to bring down the another server (B) >> >> >> > connected >> >> >> > to >> >> >> > the >> >> >> > UPS. >> >> >> > >> >> >> > As part of the test i send a command line email before and after >> >> >> > the >> >> >> > remote >> >> >> > shutdown command so that i know that it has run. Now the remote >> >> >> > shutdown >> >> >> > command runs properly when i test it on the Server (A) and both >> >> >> > emails >> >> >> > are >> >> >> > sent. When i test it on the UPS, the emails are sent but the >> >> >> > remote >> >> >> > shutdown >> >> >> > command fails. I cannot understand why, it is obvious that the >> >> >> > command >> >> >> > is >> >> >> > running but as the emails fire, but no remote shutdown. >> >> >> > >> >> >> > Any ideas? thanks in advance >> >> >> >> >> >> You need to report precisely how the whole concept hangs together. >> >> >> Presumably you use a batch file to send the EMail message and >> >> >> perform >> >> >> the >> >> >> shutdown. Let's have a look at the batch file and the shutdown >> >> >> command! >> >> >> Since there are numerous shutdown commands, you must report which >> >> >> one >> >> >> you >> >> >> use. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >>
Guest Haggis Posted October 20, 2008 Posted October 20, 2008 Re: remote Shutdown Command I did exactly as you instructed and got the following output. Tue 21/10/2008 9:21:19.39 Tue 21/10/2008 9:21:19.41 i also added a cmd line email at the end of the script and received it. However the remote computer i attempted to shutdown did not do so. By the way here is the info on the shutdown.exe app. Location: C:\WINDOWS\system32 File Version: File5.2.3790.3959 (srv03_sp2_rtm.070216-1710) Product version: 5.2.3790.3959
Guest Pegasus \(MVP\) Posted October 20, 2008 Posted October 20, 2008 Re: remote Shutdown Command "Haggis" <Haggis@discussions.microsoft.com> wrote in message news:3E4C36CF-7180-4078-B618-C79E78782207@microsoft.com... >I did exactly as you instructed and got the following output. > > Tue 21/10/2008 9:21:19.39 > Tue 21/10/2008 9:21:19.41 > > i also added a cmd line email at the end of the script and received it. > However the remote computer i attempted to shutdown did not do so. > > By the way here is the info on the shutdown.exe app. > > Location: C:\WINDOWS\system32 > File Version: File5.2.3790.3959 (srv03_sp2_rtm.070216-1710) > Product version: 5.2.3790.3959 There is something wrong. The first line in your batch file reads echo %date% %time% %UserName% >> c:\test.log yet the output you post contains no user name. Did you spell it correctly? Try this version: @echo off echo %date% %time% >> c:\test.log set >> c:\test.log net user "%Username%" 1>>c:\test.log 2>>&1 "c:\Some Folder\shutdown.exe /.. /.. 1>>c:\test.log 2>>&1 echo %date% %time% >> c:\test.log You must, of course, add the correct switches for shutdown.exe!
Guest Haggis Posted October 20, 2008 Posted October 20, 2008 Re: remote Shutdown Command The command i am using is: C:\WINDOWS\system32\shutdown.exe /s /f /m \\VAUGHN output: Tue 21/10/2008 9:44:02.03 ALLUSERSPROFILE=C:\Documents and Settings\All Users CASHCOMP=C:\Program Files\CA\SharedComponents\ ClusterLog=C:\WINDOWS\Cluster\cluster.log CommonProgramFiles=C:\Program Files\Common Files COMPUTERNAME=SLSVFL ComSpec=C:\WINDOWS\system32\cmd.exe FP_NO_HOST_CHECK=NO IGW_LOC=C:\PROGRAM FILES\CA\SharedComponents\iTechnology\ INOCULAN=C:\Program Files\CA\eTrustITM ITMLICENSE=C:\Program Files\CA\SharedComponents\SubscriptionLicense\ ITMTHIRDPARTY=C:\Program Files\CA\SharedComponents\ThirdParty\ NUMBER_OF_PROCESSORS=1 OS=Windows_NT Path=C:\Program Files\Dell\OpenManage\Drac\client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\CA\SharedComponents\ScanEngine;C:\Program Files\CA\SharedComponents\CAUpdate\;C:\Program Files\CA\SharedComponents\ThirdParty\;C:\Program Files\CA\SharedComponents\SubscriptionLicense\;C:\Program Files\CA\eTrustITM;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Dell\SysMgt\oma\bin PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH PROCESSOR_ARCHITECTURE=x86 PROCESSOR_IDENTIFIER=x86 Family 6 Model 11 Stepping 1, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=0b01 ProgramFiles=C:\Program Files PROMPT=$P$G SystemDrive=C: SystemRoot=C:\WINDOWS TEMP=C:\WINDOWS\TEMP TMP=C:\WINDOWS\TEMP USERPROFILE=C:\Documents and Settings\Default User windir=C:\WINDOWS The syntax of this command is: NET USER [username [password | *] [options]] [/DOMAIN] username {password | *} /ADD [options] [/DOMAIN] username [/DELETE] [/DOMAIN] Tue 21/10/2008 9:44:02.20 "Pegasus (MVP)" wrote: > > "Haggis" <Haggis@discussions.microsoft.com> wrote in message > news:3E4C36CF-7180-4078-B618-C79E78782207@microsoft.com... > >I did exactly as you instructed and got the following output. > > > > Tue 21/10/2008 9:21:19.39 > > Tue 21/10/2008 9:21:19.41 > > > > i also added a cmd line email at the end of the script and received it. > > However the remote computer i attempted to shutdown did not do so. > > > > By the way here is the info on the shutdown.exe app. > > > > Location: C:\WINDOWS\system32 > > File Version: File5.2.3790.3959 (srv03_sp2_rtm.070216-1710) > > Product version: 5.2.3790.3959 > > There is something wrong. The first line in your batch file reads > echo %date% %time% %UserName% >> c:\test.log > yet the output you post contains no user name. Did you spell it correctly? > Try this version: > > @echo off > echo %date% %time% >> c:\test.log > set >> c:\test.log > net user "%Username%" 1>>c:\test.log 2>>&1 > "c:\Some Folder\shutdown.exe /.. /.. 1>>c:\test.log 2>>&1 > echo %date% %time% >> c:\test.log > > You must, of course, add the correct switches for shutdown.exe! > > >
Guest Pegasus \(MVP\) Posted October 20, 2008 Posted October 20, 2008 Re: remote Shutdown Command I don't know how you're invoking the shutdown script but the method you use does not appear to set a user name. This is the reason why the remote shutdown fails. To gain access to a remote resource you MUST use an account/password that is recognised by the remote machine. You could do it by preceding the shutdown command with psexec.exe (http://www.sysinternals.com), e.g. like so: psexec.exe \\vaughn -u haggis -p SomePassword c:\windows\system32\shutdown.exe /L /s /f Do not use the /m switch with the above command. "Haggis" <Haggis@discussions.microsoft.com> wrote in message news:218731A8-3A94-421C-AE2B-08301208F703@microsoft.com... > The command i am using is: > C:\WINDOWS\system32\shutdown.exe /s /f /m \\VAUGHN > > output: > Tue 21/10/2008 9:44:02.03 > ALLUSERSPROFILE=C:\Documents and Settings\All Users > CASHCOMP=C:\Program Files\CA\SharedComponents\ > ClusterLog=C:\WINDOWS\Cluster\cluster.log > CommonProgramFiles=C:\Program Files\Common Files > COMPUTERNAME=SLSVFL > ComSpec=C:\WINDOWS\system32\cmd.exe > FP_NO_HOST_CHECK=NO > IGW_LOC=C:\PROGRAM FILES\CA\SharedComponents\iTechnology\ > INOCULAN=C:\Program Files\CA\eTrustITM > ITMLICENSE=C:\Program Files\CA\SharedComponents\SubscriptionLicense\ > ITMTHIRDPARTY=C:\Program Files\CA\SharedComponents\ThirdParty\ > NUMBER_OF_PROCESSORS=1 > OS=Windows_NT > Path=C:\Program > Files\Dell\OpenManage\Drac\client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program > Files\CA\SharedComponents\ScanEngine;C:\Program > Files\CA\SharedComponents\CAUpdate\;C:\Program > Files\CA\SharedComponents\ThirdParty\;C:\Program > Files\CA\SharedComponents\SubscriptionLicense\;C:\Program > Files\CA\eTrustITM;C:\Program Files\Microsoft SQL > Server\90\Tools\binn\;C:\Program Files\Dell\SysMgt\oma\bin > PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH > PROCESSOR_ARCHITECTURE=x86 > PROCESSOR_IDENTIFIER=x86 Family 6 Model 11 Stepping 1, GenuineIntel > PROCESSOR_LEVEL=6 > PROCESSOR_REVISION=0b01 > ProgramFiles=C:\Program Files > PROMPT=$P$G > SystemDrive=C: > SystemRoot=C:\WINDOWS > TEMP=C:\WINDOWS\TEMP > TMP=C:\WINDOWS\TEMP > USERPROFILE=C:\Documents and Settings\Default User > windir=C:\WINDOWS > The syntax of this command is: > > > NET USER > [username [password | *] [options]] [/DOMAIN] > username {password | *} /ADD [options] [/DOMAIN] > username [/DELETE] [/DOMAIN] > > Tue 21/10/2008 9:44:02.20 > > "Pegasus (MVP)" wrote: > >> >> "Haggis" <Haggis@discussions.microsoft.com> wrote in message >> news:3E4C36CF-7180-4078-B618-C79E78782207@microsoft.com... >> >I did exactly as you instructed and got the following output. >> > >> > Tue 21/10/2008 9:21:19.39 >> > Tue 21/10/2008 9:21:19.41 >> > >> > i also added a cmd line email at the end of the script and received it. >> > However the remote computer i attempted to shutdown did not do so. >> > >> > By the way here is the info on the shutdown.exe app. >> > >> > Location: C:\WINDOWS\system32 >> > File Version: File5.2.3790.3959 (srv03_sp2_rtm.070216-1710) >> > Product version: 5.2.3790.3959 >> >> There is something wrong. The first line in your batch file reads >> echo %date% %time% %UserName% >> c:\test.log >> yet the output you post contains no user name. Did you spell it >> correctly? >> Try this version: >> >> @echo off >> echo %date% %time% >> c:\test.log >> set >> c:\test.log >> net user "%Username%" 1>>c:\test.log 2>>&1 >> "c:\Some Folder\shutdown.exe /.. /.. 1>>c:\test.log 2>>&1 >> echo %date% %time% >> c:\test.log >> >> You must, of course, add the correct switches for shutdown.exe! >> >> >>
Guest Haggis Posted October 21, 2008 Posted October 21, 2008 Re: remote Shutdown Command Yes !!!! once i got all syntax on the same line (i am going a little cross eyed by now) it worked! c:\windows\psexec.exe \\vaughn -u domain\username -p password shutdown.exe /s /f I had remove the /L as the shutdown.exe on the remote server again is a different 'flavour' Thanks a lot for your perseverance mate...this has been a bit of a tricky one. All the best...BOB "Pegasus (MVP)" wrote: > I don't know how you're invoking the shutdown script but the method you use > does not appear to set a user name. This is the reason why the remote > shutdown fails. To gain access to a remote resource you MUST use an > account/password that is recognised by the remote machine. You could do it > by preceding the shutdown command with psexec.exe (http://www.sysinternals.com), > e.g. like so: > > psexec.exe \\vaughn -u haggis -p SomePassword > c:\windows\system32\shutdown.exe /L /s /f > > Do not use the /m switch with the above command. > > > "Haggis" <Haggis@discussions.microsoft.com> wrote in message > news:218731A8-3A94-421C-AE2B-08301208F703@microsoft.com... > > The command i am using is: > > C:\WINDOWS\system32\shutdown.exe /s /f /m \\VAUGHN > > > > output: > > Tue 21/10/2008 9:44:02.03 > > ALLUSERSPROFILE=C:\Documents and Settings\All Users > > CASHCOMP=C:\Program Files\CA\SharedComponents\ > > ClusterLog=C:\WINDOWS\Cluster\cluster.log > > CommonProgramFiles=C:\Program Files\Common Files > > COMPUTERNAME=SLSVFL > > ComSpec=C:\WINDOWS\system32\cmd.exe > > FP_NO_HOST_CHECK=NO > > IGW_LOC=C:\PROGRAM FILES\CA\SharedComponents\iTechnology\ > > INOCULAN=C:\Program Files\CA\eTrustITM > > ITMLICENSE=C:\Program Files\CA\SharedComponents\SubscriptionLicense\ > > ITMTHIRDPARTY=C:\Program Files\CA\SharedComponents\ThirdParty\ > > NUMBER_OF_PROCESSORS=1 > > OS=Windows_NT > > Path=C:\Program > > Files\Dell\OpenManage\Drac\client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program > > Files\CA\SharedComponents\ScanEngine;C:\Program > > Files\CA\SharedComponents\CAUpdate\;C:\Program > > Files\CA\SharedComponents\ThirdParty\;C:\Program > > Files\CA\SharedComponents\SubscriptionLicense\;C:\Program > > Files\CA\eTrustITM;C:\Program Files\Microsoft SQL > > Server\90\Tools\binn\;C:\Program Files\Dell\SysMgt\oma\bin > > PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH > > PROCESSOR_ARCHITECTURE=x86 > > PROCESSOR_IDENTIFIER=x86 Family 6 Model 11 Stepping 1, GenuineIntel > > PROCESSOR_LEVEL=6 > > PROCESSOR_REVISION=0b01 > > ProgramFiles=C:\Program Files > > PROMPT=$P$G > > SystemDrive=C: > > SystemRoot=C:\WINDOWS > > TEMP=C:\WINDOWS\TEMP > > TMP=C:\WINDOWS\TEMP > > USERPROFILE=C:\Documents and Settings\Default User > > windir=C:\WINDOWS > > The syntax of this command is: > > > > > > NET USER > > [username [password | *] [options]] [/DOMAIN] > > username {password | *} /ADD [options] [/DOMAIN] > > username [/DELETE] [/DOMAIN] > > > > Tue 21/10/2008 9:44:02.20 > > > > "Pegasus (MVP)" wrote: > > > >> > >> "Haggis" <Haggis@discussions.microsoft.com> wrote in message > >> news:3E4C36CF-7180-4078-B618-C79E78782207@microsoft.com... > >> >I did exactly as you instructed and got the following output. > >> > > >> > Tue 21/10/2008 9:21:19.39 > >> > Tue 21/10/2008 9:21:19.41 > >> > > >> > i also added a cmd line email at the end of the script and received it. > >> > However the remote computer i attempted to shutdown did not do so. > >> > > >> > By the way here is the info on the shutdown.exe app. > >> > > >> > Location: C:\WINDOWS\system32 > >> > File Version: File5.2.3790.3959 (srv03_sp2_rtm.070216-1710) > >> > Product version: 5.2.3790.3959 > >> > >> There is something wrong. The first line in your batch file reads > >> echo %date% %time% %UserName% >> c:\test.log > >> yet the output you post contains no user name. Did you spell it > >> correctly? > >> Try this version: > >> > >> @echo off > >> echo %date% %time% >> c:\test.log > >> set >> c:\test.log > >> net user "%Username%" 1>>c:\test.log 2>>&1 > >> "c:\Some Folder\shutdown.exe /.. /.. 1>>c:\test.log 2>>&1 > >> echo %date% %time% >> c:\test.log > >> > >> You must, of course, add the correct switches for shutdown.exe! > >> > >> > >> > > >
Guest Pegasus \(MVP\) Posted October 21, 2008 Posted October 21, 2008 Re: remote Shutdown Command "Haggis" <Haggis@discussions.microsoft.com> wrote in message news:A3895A05-05DD-4C80-BE93-01E0E9D4DF7D@microsoft.com... > Yes !!!! > > once i got all syntax on the same line (i am going a little cross eyed by > now) it worked! > c:\windows\psexec.exe \\vaughn -u domain\username -p password > shutdown.exe /s /f > I had remove the /L as the shutdown.exe on the remote server again is a > different 'flavour' > > Thanks a lot for your perseverance mate...this has been a bit of a tricky > one. > > All the best...BOB > Thanks for the feedback.
Recommended Posts