Solved

Shutting down workstations remotely and getting a report for success and failures

Posted on 2008-10-23
6
377 Views
Last Modified: 2012-05-05
We've used shutdown.exe and BeyondExec with Windows Task Scheduler to shutdown workstations remotely. It doesn't always work, and in some cases machines get turned on afterwards for those buring the midnight oil. Does anyone out there know of a utility or trick that will shut down workstations remotely and provide a report about it's successes and failures to do so?
0
Comment
Question by:quiet_tree
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:gratex_ssd
ID: 22791881
1) script - shutdown, then wait, then ping, then serach eventlog on that machine for shutdown, and after -> make report, send mail with report
2) best language -> powershell but you can chose any scripting language that you are familliar
3) if there is a machine that is doing not shutdown, but it reboots -> then you have to troubleshoot bios settings...

hope that helps...
0
 
LVL 4

Accepted Solution

by:
Patrick49er earned 500 total points
ID: 22792059
I use Sysinternals (located at: http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx) and use the psshutdown.  It is a more robust tool then what the Windows tool is.

To be able to run this batch, simply copy it and then change the paths to reflect where you put psshutdown.  This is pretty much the batch I use (with modifications to it for your purpose) to do a nightly reboot of my XP boxes.  It will log failed and successful shutdown commands.  You need to create a text file called NightlyAll.txt that has all the names of your workstations you want to have this command sent to.

title Nightly Shutdown v1.5
echo.
echo   Version date: 12/03/2007
echo   Version 1.5
echo.

rem  Version 1.5 added log entry for the computer being rebooted.
rem  Version 1.4 added date and space for the NightlyReboot.txt file.
rem  Version 1.3 added the log file for tracking systems that have reboot issues.
rem  Version 1.2 added the Logs folder in R:\Utility folder.

rem  Printed 07/25/2005

rem  This batch program is used to restart computers remotely.  This
rem  comes in handy for getting systems to a fresh state for the users
rem  for the next day, or performing a remote boot for maintenance
rem  purposes

  set a=
  set b=
  set c=
  set d=

:Main
  set a=NightlyAll
  for /F %%c in (R:\Utility\Checks\Lists\%a%.txt) do (
    set comp=%%c
    call :PowerOff
  )
goto :End

:PowerOff
  echo  Shutting down %comp%.
  echo. >> R:\Utility\Logs\Shutdown.log
  echo. >> R:\Utility\Logs\Shutdown.log
  echo  --------------------------------------------------------------------------------- >> R:\Utility\Logs\Shutdown.log
  echo  Shutting down %comp%. >> R:\Utility\Logs\Shutdown.log
  now >> R:\Utility\Logs\Shutdown.log
    C:\PSTools2_6\psshutdown -t 120 -m "Your system is being shutdown for maintenance purposes.  You have 2 minutes to save any unsaved data." -f \\%comp% >> R:\Utility\Logs\Shutdown.log
  echo  --------------------------------------------------------------------------------- >> R:\Utility\Logs\Shutdown.log
  if errorlevel 1 now >> R:\Utility\Logs\Shutdown.log
  if errorlevel 1 echo %comp% was not able to be shutdown. >> R:\Utility\Logs\Shutdown.log
  if errorlevel 1 echo. >> R:\Utility\Logs\Shutdown.log
goto :eof

:End
  echo.
  echo   The batch file has completed successfully!!!
  echo.
goto :eof
0
 

Author Comment

by:quiet_tree
ID: 22797719
Interesting.
The beyondexec software allows users to cancel the shutdown process. This feature is important to end-users. Does psshutdown have this feature?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:Patrick49er
ID: 22797761
Yes it does.  With the -c switch, you can allow the shutdown to be aborted by the interactive user.
0
 

Author Comment

by:quiet_tree
ID: 22814474
What does the following line in your script do:

now >> R:\Utility\Logs\Shutdown.log
0
 
LVL 4

Expert Comment

by:Patrick49er
ID: 22815355
The now statement captures the time and date that the command is executing; which in this case means what time the shutdown command is being sent.  If at a command prompt you type "now /?" you will get an explanation.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to set-up an On Demand, IPSec, Site to SIte, VPN from a Draytek Vigor Router to a Cyberoam UTM Appliance. A concise guide to the settings required on both devices
David Varnum recently wrote up his impressions of PRTG, based on a presentation by my colleague Christian at Tech Field Day at VMworld in Barcelona. Thanks David, for your detailed and honest evaluation!
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question