I'm in the process of migrating users between Entra ID tenants and need to reset their systems. Since the users don't have admin rights, I created a couple of scripts: one to return to OOBE and another that performs the reset. My colleague will make it available via Company Portal for the users.
The problem is, I want to notify users before the reset happens, ideally with a dialog box asking them if they're ready to proceed. I've managed to identify the user sessions, but I'm stuck on how to send a message box that can capture their response. Any insights or sample code would be greatly appreciated!
5 Answers
I usually go for a simple method: create a flag file. The first script can write "AwaitUser.txt", and then another script running as the user can prompt them when that file is present. Once they're confirmed, it writes "UserConfirmed.txt", allowing your main script to proceed.
You might want to try using "ServiceUI" from MDT; it can help with sending interactive prompts to users. Definitely worth a shot!
Interacting with a logged-on user from a script running under the system account can be tricky. Instead, consider running a secondary script within the user's session that communicates with your main script. This could involve methods like checking a file, using registry keys, or even setting up named pipes for the interaction.
Have you thought about creating a scheduled task? You can run it in the specific user context and trigger it to display your prompt. It might also help to save the output from the user's script to a file, which your system context script can then read.
Using PInvoke with `WTSSendMessage` should do the trick! This allows you to target a specific user session. Just remember to determine the right console session to send the message to. You can find the details on Microsoft's API documentation.
Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures