Sysinternals Homepage
Forum Home Forum Home > Sysinternals Utilities > PsTools
  New Posts New Posts RSS Feed - PsShutdown Temperamental Execution
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

PsShutdown Temperamental Execution

 Post Reply Post Reply
Author
Message
schriscoli View Drop Down
Newbie
Newbie
Avatar

Joined: 19 July 2007
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote schriscoli Quote  Post ReplyReply Direct Link To This Post Topic: PsShutdown Temperamental Execution
    Posted: 19 July 2007 at 4:03am
Hi,

I work in an environment with around 60 machines.  All part of a domain.

I wish to use PsShutdown to shutdown all the clients at a specific time of the day. 

In order to facilitate this, I have a scheduled task on one of our servers which at a specified time runs this scripts.


c:\progra~1\pstools\psshutdown -accepteula @c:\progra~1\pstools\computers.txt -f -c -t 60 -m "this computer is shutting down in 60 seconds" -n 10 >results.txt


Computers.txt contains all the IP addresses of the computers I want shutdown. 

All our client machines are running Windows XP SP2,  and I assign the scheduled task my user details (domain admin).  Im also using PSTools v.2.43.

As far as I can see there are no issues with user rights, (I can access all admin$ shares). 

Heres what happens.

Time will strike, script will start to run.

This is where the problem starts.  There appears to be no logic as to what machine is shutting down.

Computer A: shutdown
Computer B: shutdown
Computer C: fail
Computer D: fail
Computer E: shutdown.
 wash rinse repeat.

Now, if I manually send the command to the machine that fails, it works 100%. 

Run the script again, and this time

Computer A: Shutdown
Computer B: Fail
Computer C: Shutdown
Computer D: Shutdown
Computer E: Fail

There appears to be no consistency.  Some machines are great and always shutdown, but theres a few which seem to ignore the command.

Now at the time the scripts are run, no users are using the machines, so user intervention is ruled out.

Additionally another annoyance, which I suspect is more to do with scheduled tasks, is that if the script fails on a computer, the script just keeps running indefinately, and has to be stopped manually.

Not really ideal when you want this process to be automated.

Any help would be appreciated.


Back to Top
Karlchen View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 June 2005
Location: Germany
Status: Offline
Points: 5131
Post Options Post Options   Thanks (0) Thanks(0)   Quote Karlchen Quote  Post ReplyReply Direct Link To This Post Posted: 19 July 2007 at 5:08am
Hi, schriscoli.
 
As the behaviour is - using your own term - temperamental, you might consider increasing the timeout value in your -n 10 option to let us say -n 30.
(10 seconds might not be enough in all cases for psshutdown to contact a machine, launch the psshutdown service and disconnect again. Hence each machine behaves unpredictably.)
 
The other (tedious) way would be to check the local eventlog of each machine that did not shutdown for error messages about a PsShutdown service.
 
Karl
 
Back to Top
schriscoli View Drop Down
Newbie
Newbie
Avatar

Joined: 19 July 2007
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote schriscoli Quote  Post ReplyReply Direct Link To This Post Posted: 19 July 2007 at 6:28am
Thanks Karlchen,

I'll give the n timeout a tweak as you suggest.

As for the event logs. 

Ive reviewed the machines.  When it works fine, there IS an event started by my user initiating the psshutdown sequence.

For those that failed, at the expected time of shutdown there was an event stating that the Remote Access Connection Manager had started. 

I feel its too coincidental timewise to be unrelated.


Back to Top
Karlchen View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 June 2005
Location: Germany
Status: Offline
Points: 5131
Post Options Post Options   Thanks (0) Thanks(0)   Quote Karlchen Quote  Post ReplyReply Direct Link To This Post Posted: 19 July 2007 at 11:49am
Hello, schriscoli.

About the eventlog entries on machines where psshutdown failed:

Hm, actually I would have expected a message holding some error related to the "PsShutdown" service (tab SYSTEM).
Yet, maybe the error really is that the remote connection cannot be initiated correctly or not in a timely fashion so that the next step, initiating the temporary PsShutdown service, is never started at all.

Well, let's wait and see if increasing the timeout value will help.

Kind regards,
Karl
Back to Top
schriscoli View Drop Down
Newbie
Newbie
Avatar

Joined: 19 July 2007
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote schriscoli Quote  Post ReplyReply Direct Link To This Post Posted: 26 July 2007 at 2:28am
Hey Karl,

your suggestion of timeout worked a treat, the job seems to be successfully running and the schedule task isnt hanging at all.

Much appreciated sir.

Thanks

Simon
Back to Top
Karlchen View Drop Down
Senior Member
Senior Member
Avatar

Joined: 18 June 2005
Location: Germany
Status: Offline
Points: 5131
Post Options Post Options   Thanks (0) Thanks(0)   Quote Karlchen Quote  Post ReplyReply Direct Link To This Post Posted: 26 July 2007 at 4:16am
Hello, Simon.

Thanks a lot for your feedback. You're welcome. - We love threads with a Happy End.

Karl
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down