Freigeben über


Roaming gadgets on a USB key

DISCLAIMER: This post is relevant for the Vista v1 version of Sidebar, but isn’t guaranteed to work on future versions. Hopefully we’ll be able to devise a more streamlined method of roaming gadgets and settings in the future.

Sidebar by default will use settings and gadgets that have been installed to your user profile. Many folks use multiple computers and don’t have easy methods of duplicating their user profiles between computers. Even on domain joined computers and accounts with roaming profiles, gadgets don’t roam. Additionally, some folks use shared computers with profiles that get wiped out every night. For most of these scenarios, Sidebar users typically only have access to the standard Vista gadgets and any shared gadgets the system administrator has installed. Fear not, roaming users, Sidebar does have support for carrying your gadgets and settings with you!

USB storage keys are pretty cheap these days, and they have plenty of room for storing gadgets. We can copy our gadgets and settings to this USB key, edit the settings file to make it drive-letter independent, and use a simple batch file to execute Sidebar in such a way that our gadgets and settings are loaded from the USB key instead of from the user profile.

 

Step 1: Copy the installed gadgets to the usb key

On Vista your settings and user-installed gadgets are found in “%userprofile%\appdata\local\microsoft\windows sidebar”. Gadgets which were installed by your system administrator are installed in “%programfiles%\windows sidebar\shared gadgets”.

a. On your USB volume (let’s assume it is on E: for these instructions), create a folder called sblocal

b. Copy the entire folder tree from “%userprofile%\appdata\local\microsoft\windows sidebar” to e:\sblocal.

c. You should now have settings.ini file under e:\sblocal, and all your user gadgets are under e:\sblocal\gadgets.

d. If you want to roam your admin-installed shared gadgets too, copy the entire folder tree from “%programfiles%\windows sidebar\shared gadgets” to e:\sblocal\gadgets

Step 2: Edit settings.ini to make it drive-letter independent

Sidebar supports environment variable expansion when figuring out where gadget files live. We can replace the drive-letter-based paths in our local settings.ini file to redirect Sidebar to look where we want for a given gadget.

a. Open settings.ini in your favorite text editor. <shameless plug>Note that the Find/Replace All functionality in Notepad on Vista is hundreds of times faster than it was in XP so Notepad is a good choice for this. </shameless plug>

b. Each section in the settings.ini file will have an entry called “PrivateSetting_GadgetName” whose value is set to the folder where the gadget files are found. EG, my calculator.gadget entry looks like this:

PrivateSetting_GadgetName="C:%5CUsers%5Cdavidshi%5CAppData%5CLocal%5CMicrosoft%5CWindows%20Sidebar%5CGadgets%5Ccalculator%5B1%5D.gadget"

c. I need to change every occurrence of my user profile-based path to use an environment variable called GADGETS_USER. GADGETS_USER is the variable that sidebar uses as the default location for finding user-installed gadgets to show in the gallery, so it’s a good variable to use here for consistency.

d. To do this, I will replace every occurrence of “C:%5CUsers%5Cdavidshi%5CAppData%5CLocal%5CMicrosoft%5CWindows%20Sidebar%5CGadgets%5C” with “%GADGET_USER%”, so my new entry for calculator will look like this:

PrivateSetting_GadgetName="%GADGETS_USER%\calculator%5B1%5D.gadget"

e. Similarly, for any system-provided gadget I want to use, I need to replace the string “C:%5CProgram%20Files” with “%PROGRAMFILES%”

f. Finally, for any of the Shared Gadgets I want to use, I need to replace the string “C:%5CProgram%20Files%5CWindows%20Sidebar%5CShared%20Gadgets” with “%GADGETS_USER%” so they will be mapped to the copies on my usb key

Step 3: Create a batch file for running sidebar with the right settings and gadgets

Now we can take advantage of Sidebar’s use of some environment variables to redirect it to use our local copies. GADGETS_SETTINGS tells sidebar where to find settings.ini, and GADGETS_USER tells sidebar where to look for gadgets to display in the gallery.

a. Under e:\sblocal, create a new text file called sb.cmd

b. Add these lines to the file and save it:

pushd %~dp0

set GADGETS_SETTINGS=%~dp0

set GADGETS_USER=%~dp0\gadgets

start sidebar

popd

Now you can plug your USB key into any Vista computer, exit the default Sidebar process that runs on logon, and run the sblocal\sb.cmd script to launch sidebar with your custom gadgets and settings. Note that if you add any new gadget instances to sidebar while roaming, you may have to repeat step 2.

Enjoy!

Comments

  • Anonymous
    November 21, 2006
    Where does James come up with this stuff?!? Don this part is for you &ndash; &ldquo;Now, the process

  • Anonymous
    January 05, 2007
    How could we take this and put these into an actual roaming profile (as an administrator).  Obviously I can move the files from local to roaming - but my concern would be is there a group policy that we can set that would globally change the values for this in the domain?  I ask for more then just the obvious - but you started to hint on it about installing new applets... they'll install back to the old path... so is there a global way to change this via a policy somewhere that could be pushed out and force all new applets to go to the new path?  Thanks!

  • Anonymous
    September 30, 2007
    QUOTE: {settings and user-installed gadgets are found in “%userprofile%appdatalocalmicrosoftwindows sidebar”. Gadgets which were installed by your system administrator are installed in “%programfiles%windows sidebarshared gadgets”.  } I do not have a appdata dir under any user.   Futhermore, If I go to windows sidebar on my admin account, none of the gadgets appear under "shared gadgets" (subdir is empty).   C:Program FilesWindows SidebarGadgets only shows default gadgets included with vista, non of the new gadgets I installed appear anywhere.   Is it possible that I have a newer sidebar version?  Could someone update this blog. I think this roaming application will be useful to a lot of people.   Thank you!

  • Anonymous
    November 02, 2007
    Using an USB stick and a batch-file is not an acceptable method of making an application roaming. The normal way should be to put both the gadgets and their settings in the roaming part of the userprofile. Being able to redirect these files to i.e. the homefolder of the user would be an extra. Being able to manage the sidebar using GPO's would be a 'nice to have'. I hope, no i expect SP1 to solve this.