Reboot Step Question
How can i use to reboot step to detect if user is logged into the machine and if they restart the machine to not do the reboot step since the user restarted instead?
0
Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.
How can i use to reboot step to detect if user is logged into the machine and if they restart the machine to not do the reboot step since the user restarted instead?
Comments
Can you create a package that will look for the process 'explorer.exe' and if it's not running, then do a reboot?
In the reboot step, go to Conditions, and select "Only run if no user is logged on" in the Logged On State dropdown.
@Heather,
I haven't tried that yet. I will test it and see if it works
@Monica,
I could use this however i still want the machine to reboot if the user is logged in but i want the reboot step to stop if the user restarts instead of the package.
This is part of an project to get WSUS setup within our environment. I was looking into using WSUS + PDQ Inventory for an collection of machine + PDQ Deploy to send an script to the collection to pull from wsus
I'm slighty confused as to your request. What is the package doing that you need to figure out if a User restarts the machine or not? Are you going to script Windows Updates to install from the WSUS server, and see if they click on the Restart Computer to finish updates prompt? If they don't, you'll do a reboot step?
When is this going to run? 1:00PM on Tuesday? I can't imagine having your machine reboot on you due to updates in the middle of working on something would lead to a happy user experience.
That said, Inventory has a "needs Reboot" Field in the Computer Section for each PC. I'm not 100% what mechanism they use to get the Yes/No value there.
However, there are a few registry keys of interest here:
HKLM\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto
Update\RebootRequired
You could possibly do a registry check there for a value of 1 on the RebootCheckRequired key. This means that the User did not initiate a Restart, and that the reboot step should fire. Similarly, if the First key contains any data whatsoever, a Reboot is pending. This is for software other than Windows Updates, and likely not in the scope of what you are trying to accomplish, but I wanted to add it just in case I am misinterpreting.
Again, I'm not 100% sure where they pull that Reboot Required Yes/No value from, but my guess is a check on one of those 2 places.
You could also probably write a powershell script that queries the Inventory database for the target PC, and checks the Value of that field in the Computers table and write it to the registry of the target. Set a Registry key, value of 0 for no reboot, 1 for reboot, and add a registry condition querying that field. If 1, the reboot step happens, if 0 it stops due to registry condition.
I know I've posted, and Colby as well the registry location we write things too, I believe it is HKEY_Current_Config, but I need to double check and I'll edit this post with the proper Powershell code to get you going.
I hope all that is helpful. I *think* this is possible, but we need to do some digging/testing to get it just right :)
Stephen,
I haven't figured out everything yet for this however it might be better just to have the script do all the work however the question i had still stands. Some of the packages that i send out require an reboot however must of the users never log out of their machines and i wanted to be able to send an message to give them an warning that the machine is going to reboot in set amount of time however if the user restarts their own machine that the reboot step doesn't run
What kind of setup are you using for WSUS?
We are in the process of trying to setup WSUS. Right now i have it setup as Option 3 "Auto download only using GPO to push these settings out to targets groups and was going to use an script to do an WSUS Pull to install the updates and restart if needed but gives them message to restart and force restart at x time however i haven't able to find an good script for this yet
This comes from my new boss that said they have an script that was used to install updates but didn't have the clients check into WSUS and restarts but lets the users know to restart or it will auto restart and to turn off the logging software at the same time so they don't get flood with errors