remote Shutdown Command

H

Haggis

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
 
P

Pegasus \(MVP\)

Haggis said:
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.
 
H

Haggis

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
 
P

Pegasus \(MVP\)

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!).
 
H

Haggis

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) said:
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 said:
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
 
P

Pegasus \(MVP\)

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 said:
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) said:
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 said:
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

:


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.
 
H

Haggis

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

Pegasus (MVP) said:
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 said:
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) said:
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!).


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

:


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.

 
P

Pegasus \(MVP\)

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 said:
Usage: shutdown [/i | /l | /s | /r | /a | /p | /h | /e] [/f]
[/m \\computer][/t xxx][/d [p:]xx:yy [/c "comment"]]

Pegasus (MVP) said:
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 said:
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?

:

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!).


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

:


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.

 
H

Haggis

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
 
P

Pegasus \(MVP\)

Haggis said:
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!
 
H

Haggis

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
 
P

Pegasus \(MVP\)

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 (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 said:
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) said:
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!
 
H

Haggis

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) said:
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 (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 said:
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) said:
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!
 
P

Pegasus \(MVP\)

Haggis said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top