Jump to content

Shutdown Script


Recommended Posts

Posted
It uses the force option from shutdown, so in theory yes?

 

In theory could also shutdown ising WMI to force issue, but not sure if this would be more reliable?

 

This script is a proof of concept for a c# application that will add extra functionality etc to force and monitor shutdown success.

 

Also whats the switch to allow the user to cancel, gonna find it now....

Posted
We wrote a multi purpose system here. Every time anyone logs in it gets logged in an SQL server with the PC details/username/time etc. The trick is to store the MAC addresses etc as well for startup scripts.

I was thinking of building that into our login logger database, but instead I decided to extract the MAC addresses from DHCP. When I run our wake-on-lan script (WoLLOP) it pulls all the MAC address / hostname pairs off our DHCP servers then uses that list to look up the hostname I've entered, so it just runs like:

 

wollop computername

 

Your method is nice too!

 

what time do you shut them down?

 

I have a scheduled script that does ours at 4pm but takes note of anyone logged in, doesnt shut them down and then a later scheduled script takes care of those ones.

 

I do something similar. From hometime onwards a script repeatedly loops through all PCs, shutting down any that have no explorer.exe running (i.e. not logged on) and have been idle for more than 20 minutes. Late at night (about 23:30 I think) a different script runs with a psshutdown -f.

 

I calculated that it's saving the school well over £10,000/year versus the laissez-faire approach.

Posted
Tested Monkeyx's VB script on all curriculum machines as I left school tonight, it did it's job. I used to use another VB script to shutdown the machines at a scheduled time but this relied upon an updated list of machines on the network, thanks to this sript thats no longer necessary.
Posted
Can anyone give any pointers as to how I might exclude an entire sub OU from being shutdown? Have a lot of computers in the OU I wish to exclude and I'd rather not have to maintain a list again!
Posted
Can anyone give any pointers as to how I might exclude an entire sub OU from being shutdown? Have a lot of computers in the OU I wish to exclude and I'd rather not have to maintain a list again!

 

Not sure if it will stop the script but blocking inheritance that or only apply it to the specific OU's

Posted (edited)

Hi, am still testing this, it seems to take a while going through the OU's, reading the text file it gets through the first two OUs fine but then seems to stop.

 

Any ideas? Got around 300 PCs to get through, so I guess it just takes a while?

 

Edit : this was running as scheduled task, just ended the task and ran seprately and it seems to be going through the OUs ok.

Edited by mullet_man
Guest monkeyx
Posted

did you un remark any of the wscript.echo statements, as they do just sit there in a scheduled task, as unable to confirm the screen response?

 

Tim

Posted
did you un remark any of the wscript.echo statements, as they do just sit there in a scheduled task, as unable to confirm the screen response?

 

Tim

not sure how much it will help but you can replace wscript.echo with msgbox ie

 

msgbox "my text goes here" & variable_name & "more text"

Posted
did you un remark any of the wscript.echo statements, as they do just sit there in a scheduled task, as unable to confirm the screen response?

 

Tim

 

Hi Tim,

 

Not touched any of the script, my scheduled task runs at different times, last one runs at 9.00pm and the text file was last modified at 02.34 so it seems to be taking a fair few hours to get through the machines.

Posted
the text file was last modified at 02.34 so it seems to be taking a fair few hours to get through the machines.

 

It looks like the script is waiting for shutdown.exe to terminate before going on to the next machine. If the target is already powered off, this means it will sit there for anything up to about two minutes before carrying on. That's probably why your task is taking so long to run, and it was one of the motivations for giving Shutdownertron a client agent, because then everything happens in parallel.

Guest monkeyx
Posted

When using version 2 of the script see http://www.edugeek.net/forums/scripts/31891-shutdown-script.html#post310503

 

It takes less than 20 minutes to shutdown 632 PCs and laptops that are already mostly turned off in our school.

 

It does not try and shutdown unless it pings.If there is a firewall rule allowing ping put not access to remotely shutdown a PC that may cause a delay?

 

But 20 mins is more than good enough for us, I could of threaded the script but lack the inclanation todo given that is just a demo script as much as anything else. ie it was a script to demo running actions against all domain PCs as much as anything.

 

I hope to be releasing a c# tool that does WAY more than this script including remote screenshots, remote closing apps, remote running apss etc, etc, without a client. As I hate client installs :)

 

Tim

  • 4 weeks later...
Guest monkeyx
Posted
I have recently added some extra information on how to run this script and set up a system to allow users to abandon the shutdown. See ShutDown Script (SlimmerIT) for more. Also been playing with google sites to host this information, which seem pretty cool.

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...