Solved

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

Posted on 2008-10-23
6
373 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

this article is a guided solution for most of the common server issues in server hardware tasks we are facing in our routine job works. the topics in the following article covered are, 1) dell hardware raidlevel (Perc) 2) adding HDD 3) how t…
Use of TCL script on Cisco devices:  - create file and merge it with running configuration to apply configuration changes
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…

746 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