7 replies
by john.tompkins2 Accepted solution
by Member 25348569 Accepted solution
if you use a GPO. You could have this script check the time since last reboot and force a reboot if necessary.
Neil :)
by john.tompkins2 Accepted solution
Thank You for your response.
Yes, I am using a GPO. My script is in the User Policy\User Configuration\Windows Settings\Scripts\Logoff
The script checks for uptime hours and if over the limit runs the shutdown command with a restart.
What happens is, when the user initiates a "logoff" I have it display a window so I can see the script executing....The script runs but it won't execute the shutdown command because windows is in a shutdown (logoff) state, and won't allow an executable to start. Any ideas?
by Member 25348569 Accepted solution
I'm assuming you're running vbscript - is that correct? If so, can you force a reboot from within the script using WMI rather than running the shutdown executable? There are four logoff/shutdown option within WMI including a 'force'.
Neil :)
by john.tompkins2 Accepted solution
....
Case "forcereboot"
intShutdownType = 6
....
Set colOperatingSystems = GetObject("winmgmts:{(Shutdown)}").ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objOperatingSystem In colOperatingSystems
ObjOperatingSystem.Win32Shutdown(6)
Next
This works great interactively, but when run in the logoff scripts from the GPO, it doesn't work.
by Member 25348569 Accepted solution
It's not something that I've ever tried. I was hoping that the Force Reboot option in WMI would work but if you've tried that then you are past where I was thinking.
If you really HAVE to reboot the systems then one easy way - but a bit gross - is to run the check for uptime and reboot at log ON. However, it's not my users that it's going to upset.
I'll keep thinking...
Neil ?:|
by john.tompkins2 Accepted solution
Yes, we really have to reboot the systems, as we have a "120" hour policy. I have been rebooting at logon time with a nice message that informs our users that they can avoid this inconvenience if they reboot their machines prior to the mandatory reboot.
I am trying to provide a less intrusive mandatory reboot for those that don't comply.
If you happen to find something please let me know, and Thank You for your input.
This discussion is closed to new replies.
Trending Desktop posts
Sort by Trending