Jump to content

Shutdown Script - Simple Question


Recommended Posts

Posted

Could someone remind me of the switch to make shutdowns optional, I run a simple script from task scheduler in server 2008 r2 which just shutsdown any machines left on, however sometimes staff are still here or the site manager is working, I have just forgotten the switch to make it optional, below is our script

 

Shutdown -f -s -m \\ICT-01

 

Thanks

Dan

Posted

I'm not sure you can using the shutdown.exe command. I use psshutdown to do it here which I know there is a switch to cancel it. Plus you can specify a text file list of computers so you dont have to have one per line in a .bat file.

 

Hope this helps.

Posted

shutdown.exe doesn't allow for cancelling without running "shutdown.exe -a" which obviously most people cannot (command prompt is likely disabled, and the user probably couldn't work out how to run it anyway). There's a million free programs out there which will give you the option, I'm with the psshutdown recommendation.

 

You *do* have PSTools installed on your management server, right?

Posted

I do this:

 

 

@echo off

REM Copies shutdown executable to local computer from network location and sets shutdown times in Scheduled Tasks.

REM Script also checks for name of pc and if found to be a server ie fp* does not copy file or add tasks.

 

 

@set str=%computername%

@set pos12=%str:~0,2%

@echo %pos12%

 

REM If computer name starts FP* ie one of the servers then do nothing

if %pos12%==FP goto End

 

REM If computer name starts IL* ie the ILIBRA server then do nothing

if %pos12%==IL goto End

 

REM Else carry out adding tasks below

 

if not exist "c:\shutdown.exe" copy "\\fp4\shapps\shutdown\shutdown.exe" c:\

 

at /delete /yes

at 09:10 /interactive /every:M,T,W,Th,F,S,Su c:\shutdown.exe -i -s shutdown -f -l 30 -m "SHUTTING DOWN INACTIVE COMPUTER."

at 10:10 /interactive /every:M,T,W,Th,F,S,Su c:\shutdown.exe -i -s shutdown -f -l 30 -m "SHUTTING DOWN INACTIVE COMPUTER."

at 11:05 /interactive /every:M,T,W,Th,F,S,Su c:\shutdown.exe -i -s shutdown -f -l 30 -m "SHUTTING DOWN INACTIVE COMPUTER."

at 11:30 /interactive /every:M,T,W,Th,F,S,Su c:\shutdown.exe -i -s shutdown -f -l 30 -m "SHUTTING DOWN INACTIVE COMPUTER."

at 12:30 /interactive /every:M,T,W,Th,F,S,Su c:\shutdown.exe -i -s shutdown -f -l 30 -m "SHUTTING DOWN INACTIVE COMPUTER."

at 13:30 /interactive /every:M,T,W,Th,F,S,Su c:\shutdown.exe -i -s shutdown -f -l 30 -m "SHUTTING DOWN INACTIVE COMPUTER."

at 14:15 /interactive /every:M,T,W,Th,F,S,Su c:\shutdown.exe -i -s shutdown -f -l 30 -m "SHUTTING DOWN INACTIVE COMPUTER."

at 14:45 /interactive /every:M,T,W,Th,F,S,Su c:\shutdown.exe -i -s shutdown -f -l 30 -m "SHUTTING DOWN INACTIVE COMPUTER."

at 15:45 /interactive /every:M,T,W,Th,F,S,Su c:\shutdown.exe -i -s shutdown -f -l 30 -m "SHUTTING DOWN INACTIVE COMPUTER."

at 16:45 /interactive /every:M,T,W,Th,F,S,Su c:\shutdown.exe -i -s shutdown -f -l 30 -m "SHUTTING DOWN INACTIVE COMPUTER."

at 18:00 /interactive /every:M,T,W,Th,F,S,Su c:\shutdown.exe -i -s shutdown -f -l 30 -m "SHUTTING DOWN INACTIVE COMPUTER."

 

:END

Posted
I'm not sure you can using the shutdown.exe command. I use psshutdown to do it here which I know there is a switch to cancel it. Plus you can specify a text file list of computers so you dont have to have one per line in a .bat file.

 

Hope this helps.

 

What do you do with Win7 Machines which winge with the "interactive services" message?

Posted
I'm not sure you can using the shutdown.exe command. I use psshutdown to do it here which I know there is a switch to cancel it. Plus you can specify a text file list of computers so you dont have to have one per line in a .bat file.

 

Hope this helps.

 

Excellent

 

Ill have a look at that

Posted
shutdown.exe doesn't allow for cancelling without running "shutdown.exe -a" which obviously most people cannot (command prompt is likely disabled, and the user probably couldn't work out how to run it anyway). There's a million free programs out there which will give you the option, I'm with the psshutdown recommendation.

 

You *do* have PSTools installed on your management server, right?

 

No I do not yet have PSTools installed, I will look as PSshutdown and give it a go.

 

Thanks all

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...