How to prompt a user to log off?


Using the toolkit, how can I show a popup to the user that they need to logoff? And when that happens execute the installation code I need?
Basically I need to rename a folder that is in use when a user is logged on. So I want them to be prompted to logoff and then have my code rename the folder. Is this possible? TIA


would take care of the message, however it freezes the process until the window gets closed.
So it wont close until user closes it, unless you run it in another runspace, which is possible but a bit more work.

May I ask, why dont you use a GPO for this? You can add a logoff script with renaming the folder there.