{"id":64053,"date":"2007-09-11T01:57:00","date_gmt":"2007-09-11T01:57:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2007\/09\/11\/how-can-i-assign-multiple-home-pages-to-internet-explorer-7-0\/"},"modified":"2007-09-11T01:57:00","modified_gmt":"2007-09-11T01:57:00","slug":"how-can-i-assign-multiple-home-pages-to-internet-explorer-7-0","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/how-can-i-assign-multiple-home-pages-to-internet-explorer-7-0\/","title":{"rendered":"How Can I Assign Multiple Home Pages to Internet Explorer 7.0?"},"content":{"rendered":"<p><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" height=\"34\" alt=\"Hey, Scripting Guy! Question\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" align=\"left\" border=\"0\"> \n<P>Hey, Scripting Guy! How can I configure Internet Explorer 7 so it uses multiple home pages?<BR><BR>&#8212; PI<\/P><IMG height=\"5\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" border=\"0\"><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" height=\"34\" alt=\"Hey, Scripting Guy! Answer\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" align=\"left\" border=\"0\"><A href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><IMG class=\"farGraphic\" title=\"Script Center\" height=\"288\" alt=\"Script Center\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" align=\"right\" border=\"0\"><\/A> \n<P>Hey, PI. Just a second; before we begin, is anyone from Microsoft reading today\u2019s column? Don\u2019t be shy; raise your hand if you\u2019re from Microsoft. No one, not a single Microsoft employee is reading today\u2019s column? Excellent.<\/P>\n<P>What difference does it make if someone from Microsoft reads today\u2019s column? Well, all things considered, the Scripting Guy who writes this column would just as soon that no one he works with knows the horrible truth: the Scripting Guy who writes this column doesn\u2019t actually <I>use<\/I> Internet Explorer 7. That\u2019s right; he still uses Internet Explorer 6. Why? No real reason; he just likes Internet Explorer 6 better.<\/P>\n<P>Like we said, though, that\u2019s just between us. (Although it could be worse; he <I>could<\/I> be using Firefox or some other non-Microsoft browser.)<\/P>\n<P>Anyway, because he still uses Internet Explorer 6 (and drives a Model T, and listens to music on a gramophone, and \u2026) the Scripting Guy who writes this column didn\u2019t even know that you <I>could<\/I> configure Internet Explorer 7 to use multiple home pages. As it turns out, however, you can. Which actually makes sense: multiple tabs means that you can open up multiples pages at once. So why not multiple <I>home<\/I> pages, pages that automatically load up, each on a separate tab, every time you start Internet Explorer?<\/P>\n<P>And the best part of all? Writing a script to assign multiple home pages to Internet Explorer 7 is as easy as, well, as easy as this:<\/P><PRE class=\"codeSample\">Const HKEY_CURRENT_USER = &amp;H80000001<\/p>\n<p>strComputer = &#8220;.&#8221;<\/p>\n<p>Set objReg = GetObject(&#8220;winmgmts:\\\\&#8221; &amp; strComputer &amp; &#8220;\\root\\default:StdRegProv&#8221;)<\/p>\n<p>strKeyPath = &#8220;SOFTWARE\\Microsoft\\Internet Explorer\\Main&#8221;\nValueName = &#8220;Start Page&#8221;\nstrValue = &#8220;http:\/\/www.microsoft.com\/technet\/scriptcenter\/default.mspx&#8221;<\/p>\n<p>objReg.SetStringValue HKEY_CURRENT_USER, strKeyPath, ValueName, strValue<\/p>\n<p>ValueName = &#8220;Secondary Start Pages&#8221;<\/p>\n<p>strValue1 = &#8220;http:\/\/www.microsoft.com\/technet\/scriptcenter\/resources\/qanda\/default.mspx&#8221;\nstrValue2 = &#8220;http:\/\/www.microsoft.com\/technet\/scriptcenter\/resources\/begin\/default.mspx&#8221;\narrValues = Array(strValue1, strValue2)<\/p>\n<p>objReg.SetMultiStringValue HKEY_CURRENT_USER, strKeyPath, ValueName, arrValues\n<\/PRE>\n<P>As you can probably tell from glancing at the code, in order to configure multiple home pages for Internet Explorer 7 we need to modify the registry; in particular, we need to modify the following two registry values:<\/P>\n<TABLE class=\"\" cellSpacing=\"0\" cellPadding=\"0\" border=\"0\">\n<TBODY>\n<TR>\n<TD class=\"listBullet\" vAlign=\"top\">\u2022<\/TD>\n<TD class=\"listItem\">\n<P><B>HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page<\/B>. This is the spot where we configure the primary home page, the one that shows up in the topmost tab in Internet Explorer. If this registry location sounds familiar to you, it should: this is the same registry value used to configure the home page in previous versions of Internet Explorer.<\/P><\/TD><\/TR>\n<TR>\n<TD class=\"listBullet\" vAlign=\"top\">\u2022<\/TD>\n<TD class=\"listItem\">\n<P><B>HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\Secondary Start Pages<\/B>. This is a brand-new registry value, and just happens to be the spot where we configure the rest of our home pages. (Or, as Internet Explorer 7 terms them, \u201csecondary home pages.\u201d)This registry value doesn\u2019t exist by default; if it did, then you\u2019d already have multiple home pages. But don\u2019t worry; creating this new registry value is nowhere near as difficult as you might think it would be. (Well, unless, of course, you don\u2019t think it would be difficult at all.)<\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<P>OK, so much for <I>what<\/I> we\u2019re going to do; let\u2019s talk about how we\u2019re going to do it. To begin with, we define a constant named HKEY_CURRENT_USER and assign it the value &amp;H80000001; we\u2019ll use this constant to tell the script which registry hive we want to work with. (You\u2019re right: we <I>do<\/I> want to work with the HKEY_CURRENT_USER hive.That\u2019s because the Internet Explorer home page is configured on a per-user basis.) We then connect to the WMI service on the local computer, taking care to bind to the <B>StdRegProv<\/B> class which, unlike most of the WMI classes we work with, is found in the <B>root\\default<\/B> namespace:<\/P><PRE class=\"codeSample\">strComputer = &#8220;.&#8221;<\/p>\n<p>Set objReg = GetObject(&#8220;winmgmts:\\\\&#8221; &amp; strComputer &amp; &#8220;\\root\\default:StdRegProv&#8221;)\n<\/PRE>\n<TABLE class=\"dataTable\" id=\"EKE\" cellSpacing=\"0\" cellPadding=\"0\">\n<THEAD><\/THEAD>\n<TBODY>\n<TR class=\"record\" vAlign=\"top\">\n<TD class=\"\">\n<P><B>Note<\/B>. Could we run this same script against a <I>remote<\/I> computer? Of course we can; what fun would it be if we <I>couldn\u2019t<\/I>? To configure multiple home pages on a remote computer, just assign the name of that computer to the variable strComputer, like so:<\/P><PRE class=\"codeSample\">strComputer = &#8220;atl-ws-01&#8221;\n<\/PRE><\/TD><\/TR><\/TBODY><\/TABLE>\n<DIV class=\"dataTableBottomMargin\"><\/DIV>\n<P>After we connect to the WMI service, our next task is to assign values to three variables:<\/P>\n<TABLE class=\"\" cellSpacing=\"0\" cellPadding=\"0\" border=\"0\">\n<TBODY>\n<TR>\n<TD class=\"listBullet\" vAlign=\"top\">\u2022<\/TD>\n<TD class=\"listItem\">\n<P><B>strKeyPath<\/B>. This is the path (within the HKEY_CURRENT_USER hive) to the registry value we want to modify. In this case, that\u2019s <B>SOFTWARE\\Microsoft\\Internet Explorer\\Main<\/B>.<\/P><\/TD><\/TR>\n<TR>\n<TD class=\"listBullet\" vAlign=\"top\">\u2022<\/TD>\n<TD class=\"listItem\">\n<P><B>ValueName<\/B>. The name of the registry value to be modified. For this script, that\u2019s <B>Start Page<\/B>.<\/P><\/TD><\/TR>\n<TR>\n<TD class=\"listBullet\" vAlign=\"top\">\u2022<\/TD>\n<TD class=\"listItem\">\n<P><B>strValue<\/B>. The value to be assigned as the primary home page. Needless to say, we opted for the page that all kind and decent people use as their home page: <B>http:\/\/www.microsoft.com\/technet\/scriptcenter\/default.mspx<\/B>.<\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<P>So then how do we actually make the Script Center home page the Internet Explorer home page? Like this:<\/P><PRE class=\"codeSample\">objReg.SetStringValue HKEY_CURRENT_USER, strKeyPath, ValueName, strValue\n<\/PRE>\n<P>As you can see, all we\u2019re doing here is calling the <B>SetStringValue<\/B> method, passing the registry hive (the constant HKEY_CURRENT_USER), the registry path (strKeyPath), the registry value name (ValueName), and our new home page (strValue) as the method parameters.<\/P>\n<P>Well, that was easy, wasn\u2019t it? Now let\u2019s see what we can do about those secondary home pages.<\/P>\n<P>As we noted earlier, the URLs for secondary home pages (all of them) are stored in a registry value named Secondary Start Pages. That means the first thing we need to do is change the value of the variable ValueName:<\/P><PRE class=\"codeSample\">ValueName = &#8220;Secondary Start Pages&#8221;\n<\/PRE>\n<TABLE class=\"dataTable\" id=\"EBG\" cellSpacing=\"0\" cellPadding=\"0\">\n<THEAD><\/THEAD>\n<TBODY>\n<TR class=\"record\" vAlign=\"top\">\n<TD class=\"\">\n<P class=\"lastInCell\"><B>Note<\/B>. How come we don\u2019t change the value of the variable strKeyPath? There\u2019s a very good reason for that: we don\u2019t need to. That\u2019s because Secondary Start Pages also resides in the registry key SOFTWARE\\Microsoft\\Internet Explorer\\Main.<\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<DIV class=\"dataTableBottomMargin\"><\/DIV>\n<P>At this point, things get a tiny bit tricky. (But just a tiny bit.) The Secondary Start Pages registry value needs to have the data type REG_MULTI_SZ; that\u2019s because this key (if needed) has to be able to hold multiple values. Fortunately, that\u2019s no big deal; that simply means that any value we assign to this registry key must be passed as an array. That explains what this block of code is for:<\/P><PRE class=\"codeSample\">strValue1 = &#8220;http:\/\/www.microsoft.com\/technet\/scriptcenter\/resources\/qanda\/default.mspx&#8221;\nstrValue2 = &#8220;http:\/\/www.microsoft.com\/technet\/scriptcenter\/resources\/begin\/default.mspx&#8221;\narrValues = Array(strValue1, strValue2)\n<\/PRE>\n<P>In our first line of code, we\u2019re assigning the URL for the <A href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/resources\/qanda\/default.mspx\"><B>Hey, Scripting Guy!<\/B><\/A> column to a variable named strValue1. Why? Because we want <I>Hey, Scripting Guy!<\/I> to be one of our secondary home pages. In line 2, we assign the URL for the <A href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/resources\/begin\/default.mspx\"><B>Sesame Script<\/B><\/A> column to a variable named strValue2. Why? Because \u2013 oh, right. Guess you didn\u2019t need our help to figure <I>that<\/I> out, did you?<\/P>\n<TABLE class=\"dataTable\" id=\"ECH\" cellSpacing=\"0\" cellPadding=\"0\">\n<THEAD><\/THEAD>\n<TBODY>\n<TR class=\"record\" vAlign=\"top\">\n<TD class=\"\">\n<P class=\"lastInCell\"><B>Note<\/B>. Can you create <I>more<\/I> than 2 secondary home pages? Yes you can, although, to be honest, we\u2019re not sure what the limit is, or even if there <I>is<\/I> a limit.<\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<DIV class=\"dataTableBottomMargin\"><\/DIV>\n<P>That brings us to line 3, where we call VBScript\u2019s <B>Array<\/B> function and add our two variables (strValue1 and strValue2) to an array named arrValues.<\/P>\n<P>After we\u2019ve done that we\u2019re ready to call the <B>SetMultiStringValue<\/B> method and assign these two URLs to the registry value Secondary Start Pages. That\u2019s what we do here:<\/P><PRE class=\"codeSample\">objReg.SetMultiStringValue HKEY_CURRENT_USER, strKeyPath, ValueName, arrValues\n<\/PRE>\n<P>What\u2019s that? Didn\u2019t we say that, by default, the registry value Secondary Start Pages doesn\u2019t exist? Yes, we <I>did<\/I> say that. But, as we also said, that\u2019s no big deal. If this registry value exists then SetMultiStringValue will simply overwrite it; if the registry value <I>doesn\u2019t<\/I> exit then SetMultiStringValue will first create it, and then assign it a new value. Talk about a win-win situation, huh?<\/P>\n<P>At any rate, that should do it, PI. We\u2019re sure that today\u2019s column has generated even more questions about working with Internet Explorer 7; for example, no doubt some of you are wondering how to delete these secondary start pages, or maybe how to delete <I>one<\/I> of the secondary start pages (while leaving the other alone). We\u2019ll address some of these questions in the very near future, albeit not today. But that\u2019s all right; after all, you need some time to play around with the script that assigns multiple home pages. And the Scripting Guy who writes this column needs some time to actually install and start using Internet Explorer 7.<\/P>\n<P>Although, if anyone asks, he\u2019s been using it all along.<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! How can I configure Internet Explorer 7 so it uses multiple home pages?&#8212; PI Hey, PI. Just a second; before we begin, is anyone from Microsoft reading today\u2019s column? Don\u2019t be shy; raise your hand if you\u2019re from Microsoft. No one, not a single Microsoft employee is reading today\u2019s column? Excellent. What [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[726,3,167,5],"class_list":["post-64053","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-internet-explorer-7","tag-scripting-guy","tag-using-the-internet","tag-vbscript"],"acf":[],"blog_post_summary":"<p>Hey, Scripting Guy! How can I configure Internet Explorer 7 so it uses multiple home pages?&#8212; PI Hey, PI. Just a second; before we begin, is anyone from Microsoft reading today\u2019s column? Don\u2019t be shy; raise your hand if you\u2019re from Microsoft. No one, not a single Microsoft employee is reading today\u2019s column? Excellent. What [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/64053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=64053"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/64053\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=64053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=64053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=64053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}