Windows Sidebar, Gadgets, and Roaming Profiles

So, Roaming Profiles with Windows 7 is my current project at OSU Chemistry. One thing I noticed early on is that Gadgets don’t roam, since their data is stored in %localappdata% (kinda like Google Chrome). However, it’s pretty easy to save and restore the gadgets and gadget settings with login and logoff scripts.

The Scripts

Save-Gadgets


@ECHO OFF
REM Make sure Windows Sidebar is installed.
IF NOT EXIST "C:\Users" GOTO END
IF NOT EXIST "C:\Program Files\Windows Sidebar\sidebar.exe" GOTO END

REM Save Gadgets Data
IF NOT EXIST "\\winfs\%username%$\profile\gadgets" MKDIR "\\winfs\%username%$\profile\gadgets"
IF EXIST "C:\Users\%username%\appdata\local\microsoft\windows sidebar" COPY /Y "C:\Users\%username%\appdata\local\microsoft\windows sidebar\*" \\winfs\%username%$\profile\gadgets

:END

Restore-Gadgets


@ECHO OFF
REM Make sure Windows Sidebar is installed.
IF NOT EXIST "C:\Users" GOTO END
IF NOT EXIST "C:\Program Files\Windows Sidebar\sidebar.exe" GOTO END

REM Restore Gadgets Data
taskkill /f /im sidebar.exe
IF NOT EXIST "C:\Users\%username%\appdata\local\microsoft\windows sidebar" MKDIR "C:\Users\%username%\appdata\local\microsoft\windows sidebar"
IF EXIST "\\winfs\%username%$\profile\gadgets" COPY /Y "\\winfs\%username%$\profile\gadgets\*" "C:\Users\%username%\appdata\local\microsoft\windows sidebar"

REM start sidebar
start sidebar

:END

Enjoy your gadget’ing!

Advertisements

2 thoughts on “Windows Sidebar, Gadgets, and Roaming Profiles

  1. Thanks for this!

    Found it via Google while looking for a way to save gadget positions across different monitor setups, and it’s working perfectly.

    I have three monitors arranged horizontally, and wanted to alternate between an extended display with the middle screen being primary, and one big desktop via Eyefinity. Used your save script to give me a quick way to save gadget config off to a separate folder for each setup, then used the restore script to move back to the appdata dir and restart gadgets for each. With some presets for the monitor setups in Catalyst and setting them to call the batch files, it’s now all automatic.

  2. Very helpful, saved me a heap of time writing my own script. Thanks !

    I would suggest a slight change though, instead of “C:\Users\%username%\…”, use “%userprofile%\…”.

    Sometimes the user profile folder is not the user’s name so your code will give confusing results. Specifically, if the user has a local and domain profile there will be a “C:\Users\Bob” and a “C:\Users\Bob.Domainname”. Also if Windows can load a profile it may create a “C:\Users\Bob.0000” profile.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s