Thursday, November 13, 2008

Set Multiple home pages for IE 7 from the command line

If you look into the settings of IE 7, you can easily add more than one home page. One URL for each line. When you open IE, these will all be launched in their own tab.

I added some websites, and then I dug into the registry to see what was changed. Here is a snapshot:

That there are actually two parts to the home page setting. They are both under HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main

The first website to be displayed is stored under the string value named:
Start Page

The rest of the websites displayed are stored in a string array value named:
Secondary Start Pages

The first string is very easy to script and change.

The second is not as simple. This is because it is an array of strings separated by NULL characters, and terminated with two NULL characters.

There are a few ways to do this. One way would be to update one machine with all of your desired settings...and create an exported reg key. You could then use regedit in silent mode to import the settings on other machines.

This has its downfalls - if not done right you could accidentally pull in other values you don't want thrown around to every machine.

Another way would be to use VB Script. I wanted something cleaner, and an excuse to start using our new internal API for writing cross-compilable software (64 and 32 bit). I came up with this little command line program named IESetHomeTabs.exe

Here is how you call it from the command line:

C:>IESetHomeTabs.exe "[URL1]" "[URL2]" "[URL3]"

So if I wanted,, and as my 3 tabs I could call it like this:

C:>IESetHomeTabs.exe "" "" ""

No comments: