Posts tagged: Internet Explorer

Fixing IE cookie trouble with RES WM

By Max Ranzau

 

delcookiesFrom the Worlds Greatest Browser (Right…) Dept: In Internet Explorer 10 and up, the WebCacheV01.dat file was introduced. This file lives in %LocalAppdata%\Microsoft\Windows\WebCache. The webcache folder is hidden. The issue at hand is that the webcache file is always in use, which makes for a rainy day if you try to roam/copy IE cookies, or otherwise store them with RES User-Settings. The issue was described back in April by Rob Beekmans on his blog here.

As of now, the problem is rumored to have been addressed by Microsoft on Server 2012, but is still very much alive and kicking on Server 2008, which at the time of writing still represents a large contingent of server deployments out there.

While Mr. Beekmans illustrated the issue, my partner-in-crime the good Mr. Aarts tackled the issue head on, providing a neat and shareable solution with the RES community in the shape of a Workspace Manager buildingblock. By running a couple of strategic Powershell scripts in the users session and including a couple of extra (freeware) utilities as custom resources, the buildingblock solves the problem described above. The Workspace Manager BB includes the following:

  • A PowerShell command to set the PS execution policy to unrestricted to make sure we don’t get any unnecessary prompts when running the following items unattended:
  • A PS script running at logoff, which backs up the current webcache to a location of your choice *1). The script will create two backup .zip files for the two folders WebCache and INetCookies as well. The script will also leave 5 rotated backup file sets.
  • A PS script running at logon to restore the latest backup of these two folders to their original location
  • Both logon/logoff scripts closes all open file handles before making the backup/restore operations.
  • 7zip and SysInternals Handle64.exe are included as RESWM custom resources.

As you may infer, the above essentially extends the WM User Settings with a basic Hybrid Profile – style copyout-copyin script system. This is necessary, as UserSetting would face the same issue as any other UEM; that the target files are locked. I’d say there’s a loud and clear feature request waiting to be implemented here that could solve a lot of potential headaches for customers.

script1Important: As you can see on the screenshot, there is a couple of places you may need to modify the logon/logoff scripts. The destination where the backup files are to be stored defaults to H:\ – you may need to change that. If you already are using a UNC path like \\server\share\%username% for your User Settings, you perhaps want to consider using that as well. Just remember to add a subfolder for this, like \\server\share\%username%\IEbackup or similar. We could of course have added an environment variable so you only had to change the storage destination once, however it’s two edits. Chances are you may survive it :)

Click the brick to download the buildingblock: legobrick-cropped

Preconfigured voluntary settings in a mandatory profile

By Max Ranzau

 

This little blurb was inspired by an email to a partner, explaining the differences between the old PoweFuse products PowerLaunch section and the User Preferences (these are now known as User Settings from Powerfuse 2010 and up. This lead to an example on how you can combine these two parts of PowerFuse. The goal is to be able to provide the user with preconfigured, voluntary settings – in a mandatory profile environment. Let’s take a real-world example on this:

We have some users which share a mandatory profile, where the default webpage for IE has been set to about:blank or something else long ago. This setting coded into the .man profile and we don’t want to bother hacking into it since our goal would be to have it changed dynamically, according to group membership.

For example: We want to have users in group1 initially having www.batman.com as their homepage and group2 should have www.superman.com as their homepage. To make the entire thing a bit more interesting, we want to provide the user with the option to change their homepage to something else if they prefer to do so.

To summarize we are talking about creating a dynamic, group assigned voulentary user registry setting on top of a mandatory profile. Sounds iffy? Not at all. This example is easy to follow, but you can of course just download the PowerFuse buildingblock at the end of the article. The registry key we use for this example is HKCUSoftwareMicrosoftInternet ExplorerMainStart Page (REG_SZ)

  1. If you haven’t already done so, create a PowerFuse application for Internet Explorer (other browsers can be used, but you’ll have to figure out the registrysettings then for yourself)
  2. Edit the IE app and go to the Configuration | PowerLaunch tab, click Add.
  3. run-onceCreate a powerlaunch user registry setting for the IE startup page www.batman.com. using the HKCU registry path above. Make sure to mark the reghack with the Run-Once checkmark.
  4. group1Go to the Access Control tab of the reghack, assign it to group1.
  5. Export the newly created reghack to a temporary file. This done in the “Registry|Export registry file…” menu inside the PowerFuse export-regregistry buffer editor. We are going to use this export one steap further ahead.
  6. Save the reghack and return to the PowerLaunch tab of the application
  7. Repeat step 2 above, then go to the Registry|Import registry file… and pull the temporary regfile in again (it can safely be deleted after this btw).  In the new reghack, change the startup page to www.superman.com and assign this one to group2. Notice that the name and any comments you added before was preserved in the regfile. Once you’ve configured the reghacks for both groups it should look like this: app-registry
  8. Let’s setup the User Preferences. Go to Properties|User Preferences, while still editing the app. Here we can specify one or more seperate items which should be saved before the logoff destroys the mandatory profle. Using the Add button, you can choose to add:
    1. A single registry value (like we are using here)
    2. A registry key (containing multiple values)
    3. A registry tree (a branch containing multiple registry keys)
    4. A single file in the profile (such as normal.dot for office)
    5. A folder in the profile (such as cookies or favorites)
  9. Fashion the user preference so it looks something like this (remember, you can download the buildingblock below if you want to make sure you build it right). Click on the image to zoom.userpref-ie

When the app has been saved and the user sessions refreshed, PowerFuse will write the correct IE startup page to the registry uppon first time user launch of IE. During the session, the user may perhaps change the homepage of IE to something completely different. Regardless of this, User Preferences will capture the current value of the IE startpage key at logoff and save it, just before the mandatory profile is tossed into Mount Doom. To try all this out for yourself, download the BuildingBlock:

Rightclick and save-target-as here: legobrick_red