This article describes how to reset a run-once setting for a specific user but also how to automate it. The article expands on RES KB article 200838, which cover some of it.
The use case is that you would like to restore, say for example a default registry configuration for a user. This could also be expanded to allow the user to restore “factory settings” for a specific application on his own. For example, user Bill messes up his views in Outlook by dragging some toolbars off to one side so now nothing looks like it’s supposed to anymore. In the old days, an admin might have resorted to killing the user’s profile and let him revert to default settings uppon next login. This usually resulted in the user loosing all his other settings too.
Fortunately we are now out of the Dark Ages, and have much more refined, granular and user friendly ways of dealing with such. Heck, we might even decide to give the user a restore button for each app or groups of apps. In Workspace Manager, this is quite easy. For each setting you mark with the checkmark, a corresponding .once file is placed in the mentioned PWRMENU folder in the users home directory.
As the .once files are all named with GUID’s, the real trick is to map a given setting to the corresponding .once file, so you delete the right one.
The procedure is simple, so here’s the secret sauce: Export a buildingblock and look for the <runoncefile> of the setting.
Let’s walk through an example. Let’s say we’ve got a registry setting , such as this one on the right. This one is simple; it kills off the dopey yellow dog, which per default appears when you use the search function in Windows XP. Now, we (as admins) may think that the users are better off with out it, but a user may disagree. Therefore we tick the run-once flag on the setting, so if the user later changes the setting, we won’t override it again.
Workspace Manager remembers this by placing .once files for each setting marked with the run-once setting, in the users %homedrive%\pwrmenu folder. As mentioned above, the .once file will have a format like this: 13290F4_22379_9EC_TYPE.once. The type bit can be reg, mapi, task, etc indicating what class of setting is being remembered applied. The file itself only contains a date+time stamp in clear text when this setting was applied last.
Since we want for one reason or the other to re-apply the default setting defined in Workspace Manager, we need to find out the name of the .once file we want to delete. Here is how:
- Go to the RES console and navigate to the node where the setting is defined. In the case above, we go to the User Registry part of the console
- Rightclick on the registry item you want and select “Create Building Block”
- Once you’ve saved the buildingblock, open the file with notepad or just view it by doubleclicking on it. Per default XML files will be opened with Internet Explorer, which will give you a warning in the top of the screen. This can safely be ignored.
- In the XML, look for the tag <runoncefile>. Right after this you will find the GUID for the setting.
- Going manual, all you need to do is delete the corresponding GUID_type.once file from the users \PWRMENU folder.
There is however something very cool you can consider implementing, which actually has the potential to cut down on your support calls. How about implementing this so the user easily can reset certain critical application in case they screw up the app?
This is quite easy to implement – also in a way that the users don’t invoke it by accident. The end result looks like shown here on the right. The user clicks on the icon and is prompted for a password. If you want to give a confirmation that the order has been carried out, add a Notification to the application. Workspace Manager has a setting on each application which will prompt the user for his login password before running the app. By attaching this option to the app not only can the user not accidently hit the restore button, but neither can anyone else using his session.
This is how to implement it:
- In the Workspace Manager console, create a new empty application and select a nice icon for it from Shell32.dll or similar.
- Go to the Content|Actions tab on the application and add an Execute Command task. This will then be executed whe the user runs the app.
- Enter the command cmd /c del %homedrive%%homepath%pwrmenu\*.once and make sure you tick the Run Hidden box also
- Go to the Properties|Settings tab on the application. Tick the box for: Use extra password verification.
- Go to the Properties|Notification tab. Enter a message like “Application X has now been restored” in the bottom section when the users start the enabled application.
If you would like to try it all without too much fuss, then you can download a demo buildingblock below. Note that this BB has some more bells and whistles built in for other cleanup purposes, but perhaps these may also be usefull for you.