{"id":71053,"date":"2004-11-08T10:30:00","date_gmt":"2004-11-08T10:30:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2004\/11\/08\/how-can-i-change-the-internet-explorer-home-page\/"},"modified":"2004-11-08T10:30:00","modified_gmt":"2004-11-08T10:30:00","slug":"how-can-i-change-the-internet-explorer-home-page","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/how-can-i-change-the-internet-explorer-home-page\/","title":{"rendered":"How Can I Change the Internet Explorer Home Page?"},"content":{"rendered":"<p><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\"> \n<P>Hey, Scripting Guy! Can I change the Internet Explorer home page by using a script?<BR><BR>&#8212; AH<\/P><IMG border=\"0\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" height=\"5\"><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\"><A href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><IMG class=\"farGraphic\" title=\"Script Center\" border=\"0\" alt=\"Script Center\" align=\"right\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" height=\"288\"><\/A> \n<P>Hey, AH. It\u2019s Monday morning, and after a hard weekend of sitting around watching football, we decided to take it easy this morning. Yes, you can change the Internet Explorer home page by using a script; all you have to do is write a WMI script that modifies the <B>HKCU\\ SOFTWARE\\Microsoft\\Internet Explorer\\Main\\Start Page<\/B> registry value:<\/P><PRE class=\"codeSample\">Const HKEY_CURRENT_USER = &amp;H80000001<\/p>\n<p>strComputer = &#8220;.&#8221;\nSet 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;\nobjReg.SetStringValue HKEY_CURRENT_USER, strKeyPath, ValueName, strValue\n<\/PRE>\n<P>Boy, when we said we were going to take it easy this morning, we weren\u2019t kidding, were we? As you can see, there\u2019s not much to this script. We start by defining the constant HKEY_CURRENT_USER, setting the value to &amp;H80000001; as we\u2019ve noted in previous columns, this value tells our script to work with the HKCU portion of the registry. We then connect to the WMI service; note that the class used to modify registry values &#8211; StdRegProv &#8211; is in the root\\default namespace (which makes it different from the hundreds of WMI scripts you\u2019re probably most familiar with, almost all of which connect to the root\\cimv2 namespace).<\/P>\n<P>After that, we assign the registry path and the registry value to a pair of variables (strKeyPath and ValueName, respectively). We then assign our new home page &#8212; http:\/\/www.microsoft.com\/technet\/scriptcenter\/default.mspx &#8212; to the variable strValue. Once we get all these variables set, we then call the SetStringValue method to actually change the registry and, in turn, change the Internet Explorer home page. (As you no doubt figured out, each time Internet Explorer starts up, it checks HKCU\\ SOFTWARE\\Microsoft\\Internet Explorer\\Main\\Start Page to determine the home page.)<\/P>\n<P>The end result: a script that sets the home page of the current user to the TechNet Script Center. (Yeah, we know: that <I>is<\/I> kind of silly. After all, who doesn\u2019t <I>already<\/I> have their home page set to the TechNet Script Center?)<\/P>\n<P>Incidentally, Internet Explorer makes extensive use of the registry; in turn, that means you can easily write scripts that configure Internet Explorer settings. If you just can\u2019t wait to do this, check out the <A href=\"http:\/\/null\/technet\/scriptcenter\/tools\/twkmatic.mspx\"><B>Tweakomatic<\/B><\/A> utility, which includes scores of scripts useful in managing Internet Explorer. Or, just sit tight for a couple weeks and wait until we get all those scripts added to the Script Repository.<\/P>\n<P>Why don\u2019t we just add all those scripts today? Didn\u2019t we mention that it was <I>Monday<\/I>? We\u2019ll get them up soon.<\/P>\n<P>By the way, if all you want to do is determine the current home page configured for a user, try this script:<\/P><PRE class=\"codeSample\">On Error Resume Next<\/p>\n<p>Const HKEY_CURRENT_USER = &amp;H80000001<\/p>\n<p>strComputer = &#8220;.&#8221;\nSet objReg = GetObject(&#8220;winmgmts:\\\\&#8221; &amp; strComputer &amp; &#8220;\\root\\default:StdRegProv&#8221;)\nstrKeyPath = &#8220;SOFTWARE\\Microsoft\\Internet Explorer\\Main&#8221;\nValueName = &#8220;Start Page&#8221;\n    objReg.GetStringValue HKEY_CURRENT_USER, strKeyPath, ValueName, strValue<\/p>\n<p>If IsNull(strValue) Then\n    Wscript.Echo &#8220;The value is either Null or could not be found in the registry.&#8221;\nElse\n    Wscript.Echo strValue\nEnd If\n<\/PRE><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! Can I change the Internet Explorer home page by using a script?&#8212; AH Hey, AH. It\u2019s Monday morning, and after a hard weekend of sitting around watching football, we decided to take it easy this morning. Yes, you can change the Internet Explorer home page by using a script; all you have [&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":[17,3,167,5],"class_list":["post-71053","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-internet-explorer","tag-scripting-guy","tag-using-the-internet","tag-vbscript"],"acf":[],"blog_post_summary":"<p>Hey, Scripting Guy! Can I change the Internet Explorer home page by using a script?&#8212; AH Hey, AH. It\u2019s Monday morning, and after a hard weekend of sitting around watching football, we decided to take it easy this morning. Yes, you can change the Internet Explorer home page by using a script; all you have [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/71053","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=71053"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/71053\/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=71053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=71053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=71053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}