PsShutdown & Windows 7
We are trying to make a shutdown policy for our School with about 650 clients. We want to have a message to warn users if they are logged on at the time with an option to cancel the shutdown. We used to use Poweroff in XP but the message display will not work in 7 and the machine shuts down without any warning to a logged on user.
We've tried a couple of sceduled scripts (not Pstools) which work when user is logged on but we can't get them to work in Windows 7 machines when no user is logged on.
It looks as though PsShutdown may solve this for us from the reading the blurb. Can anyone confirm whether this will work to 1) warn a user for x minutes with a cancel option and 2) shutdown the machine (Windows 7) when no user is logged on.
Hi, as far as I'm aware PsShutdown will no longer work with W7 correctly... IIRC you can still shutdown clients but you cannot show a message or allow the user to cancel/postpone.
If anyone else knows differently then please reply as I'd like to use this tool as well.
What we really need is a new developer for the shutdownertron project, that was an awesome bit of software for XP but seems like development for W7 has died :(
Just looking at different shut down options and wondered what you ended up using.
I also would like to hear more about a resolution to this as well. I would love to have a script that runs on every machine here in our district that says "If I haven't been shut down in X days, I'll go ahead and restart tonight @ 5PM" But also inform the user in case they are logged on so as not to mess up our users while they are using the system.
I gave up trying to find any useful way to acheive what you want - I just set the power saving mode so the PC's go to sleep if not being used....
I ended up using GPP and scheduling a time they shutdown. I have also set it to wait until the computer has been idle for 10 mins which should mean only computers not being used will run the schedule. Seems to be working ok.
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set oFS = CreateObject("Scripting.FileSystemObject")
strWarning = "Due to network maintenance, this computer must be restarted. You have 5 minutes to save your work from the start of this countdown. Sorry for any inconvenience caused. "
strDelay = 300 'Delay given in seconds; change this value to your preference, or set it to 0 to give no delay at all
'Open a text file of computer names
'with one computer name per line
Set oTS = oFS.OpenTextFile("C:\computers.txt")
'go through the text file
Do Until oTS.AtEndOfStream
'get the next computer name
'store it in variable strCompname
strCompname = oTS.ReadLine
WshShell.Run "C:\Windows\System32\shutdown.exe -m \\" & strCompname & " -r -c " & Chr(34) & strWarning & Chr(34) & " -t " & strDelay 'Replace the "-r" switch with "-s" to make the computers shutdown instead
'close the text file
This is a script that I use (taken from the spiceworks forum) which gives you the warnings before shutting down the PC. I Schedul the script to run at a 7pm via GP. Hope this helps
sorry forgot to say, you need to have a text file with all your computer names. You can do this by exporting them from your AD.