<p>I need to script the creation of app pools and websites on IIS 6.0. I have been able to create these using adsutil.vbs and iisweb.vbs, but don't know how to set the version of ASP.NET for the sites I have just created to 2.0.50727.0.</p>

<p>Ideally I would like to adsutil.vbs to update the metabase. How do I do this?</p>

[{'answer_id': 20953, 'author': 'Chris Miller', 'author_id': 206, 'author_profile': 'https://Stackoverflow.com/users/206', 'pm_score': 2, 'selected': False, 'text': '<p>I found the following script <a href="http://www.diablopup.net/post/Set-an-IIS-Object%27s-ASPNET-Version-Using-VBScript.aspx" rel="nofollow noreferrer">posted</a> on Diablo Pup\'s blog.  It uses ADSI automation.</p>\n\n<pre><code>\'******************************************************************************************\n\' Name: SetASPDotNetVersion\n\' Description: Set the script mappings for the specified ASP.NET version\n\' Inputs: objIIS, strNewVersion\n\'******************************************************************************************\nSub SetASPDotNetVersion(objIIS, strNewVersion)\n Dim i, ScriptMaps, arrVersions(2), thisVersion, thisScriptMap\n Dim strSearchText, strReplaceText\n\n Select Case Trim(LCase(strNewVersion))\n  Case "1.1"\n   strReplaceText = "v1.1.4322"\n  Case "2.0"\n   strReplaceText = "v2.0.50727"\n  Case Else\n   wscript.echo "WARNING: Non-supported ASP.NET version specified!"\n   Exit Sub\n End Select\n\n ScriptMaps = objIIS.ScriptMaps\n arrVersions(0) = "v1.1.4322"\n arrVersions(1) = "v2.0.50727"\n \'Loop through all three potential old values\n For Each thisVersion in arrVersions\n  \'Loop through all the mappings\n  For thisScriptMap = LBound(ScriptMaps) to UBound(ScriptMaps)\n   \'Replace the old with the new \n   ScriptMaps(thisScriptMap) = Replace(ScriptMaps(thisScriptMap), thisVersion, strReplaceText)\n  Next\n Next \n\n objIIS.ScriptMaps = ScriptMaps\n objIIS.SetInfo\n wscript.echo "&lt;-------Set ASP.NET version to " &amp; strNewVersion &amp; " successfully.-------&gt;"\nEnd Sub \n</code></pre>\n'}, {'answer_id': 21001, 'author': 'Kev', 'author_id': 419, 'author_profile': 'https://Stackoverflow.com/users/419', 'pm_score': 4, 'selected': True, 'text': '<p>@<a href="https://stackoverflow.com/questions/20923/vbscriptiis-how-do-i-automatically-set-aspnet-version-for-a-particular-website#20953">Chris</a> beat me to the punch on the ADSI way</p>\n\n<p>You can do this using the aspnet_regiis.exe tool. There is one of these tools per version of ASP.NET installed on the machine. You could shell out to -</p>\n\n<p>This configures ASP.NET 1.1</p>\n\n<pre><code>%windir%\\microsoft.net\\framework\\v1.1.4322\\aspnet_regiis -s W3SVC/[iisnumber]/ROOT\n</code></pre>\n\n<p>This configures ASP.NET 2.0</p>\n\n<pre><code>%windir%\\microsoft.net\\framework\\v2.0.50727\\aspnet_regiis -s W3SVC/[iisnumber]/ROOT\n</code></pre>\n\n<p>You probably already know this, but if you have multiple 1.1 and 2.0 sites on your machine, just remember to switch the website you\'re changing ASP.NET versions on to compatible app pool. ASP.NET 1.1 and 2.0 sites don\'t mix in the same app pool.</p>\n'}]
['https://Stackoverflow.com/questions/20923', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/636/']