Solved

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

Posted on 2008-10-23
6
374 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
  • 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
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

More or less everybody in the IT market understands the basics of Networking, however when we start talking about Storage Networks, things get a bit dizzier, and this is where I would like to help.
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
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.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now