I’ve had an interesting AppSense-related problem over the last few days. We had a published application that was being managed by Personalization Server. However, when this application became unstable, the vendor’s resolution was to delete the user cache while the user was not using the application. The user cache, though, was stored in “virtual” files in the Personalization Server database. We could have gotten support staff to log in to the Personalization Server and remove the cache manually, but the customer maintained they wanted this to be done by the users themselves. I agreed with their sentiments – these users were call handlers, and didn’t want to be kept from their busy jobs by waiting for IT to remove the cache for them.
So, what other options did we have? The latest version of Environment Manager features a web console that allows people to log into the Personalization Server and rollback profiles, but this is more an option aimed at support staff than end-users. Apparently in EM v8.3, there will be a “Self-Service” option added to the web console, which may do what we require, but the customer in this situation was unlikely to wait for an upgrade that we weren’t able to put a definite release date on!
In Process Started nodes, you can define how various configuration items interact with Personalization items, that may or may not override each other. My next idea was to create a published application that set a Registry flag via a quick script, and then on next launch of the application, if the flag was set, it would run a File Delete action to clear the cache, using the Personalization Override option (shown below)
Sounded promising, and in my head it seemed like it would work – except for one thing I’d overlooked, not for the first time! This was the fact that users were using published applications, not desktops, so the Registry flag would be set – and then instantly discarded as the program that set the Registry flag exited and dropped the profile it had just written the flag to. So I was back to the drawing board again.
I then had a discourse with members of the AppSense User Group on LinkedIn and I was reminded by Landon Winburn of the /APPSENSESPECIAL switch (that’s what these peer groups are so useful for!) This command, when called by cmd.exe (or regedit.exe, for Registry entries as opposed to files), allows you to load the Personalization data for a specified process outside of the normal routine, and then work with it with the subsequent commands you specify. So, for application.exe, I needed to write a command line that looks like this
c:\windows\system32\cmd.exe /appsensespecial:application.exe:0.0.0.0 /c del /s %AppData%\Application\cache
This command, when created as a published application, will load the Personalization data for all versions of application.exe, and present it to the command window in the format it would normally appear to the user. Which means after the /c switch I can manipulate that data using a command, which in this case is to delete a particular folder – the user cache folder. Exactly what I needed!
Now, as mentioned earlier, if you want to manipulate Personalization Server Registry data instead of file/folder data, you simply use the /APPSENSESPECIAL command called from regedit.exe instead, such as
c:\windows\regedit.exe /S “import.reg” /APPSENSESPECIAL:application.exe:0.0.0.0
Note – if you want to use regedit.exe or reg.exe to manipulate this, you’ll have to remove the specific executable you’re using from the Default Blacklist in Application Groups in Personalization Server (thanks again, Landon!)
And if you wanted to target a particular version of the process (or, indeed, if there are multiple version numbers defined, such as you would find with Microsoft Office or the like), replace the 0.0.0.0 with the version number you are after. Be careful not to use regular expressions here – you may get inconsistent results.
So, once we’d created this command as a published application – if we’d wanted multiple commands, we’d have had to wrap them up in a command script and publish that – the users could run it to clear the cache from the application. Now, if they have issues with the app, they simply log out and run this, instead of having to put in a time-consuming call to the helpdesk.
Thanks to Landon Winburn and Paul Houlston for their help solving this problem via the AppSense User Group on LinkedIn