I got it all to work. I found another script and added part so all works including adding the asp.net version. here is full script that is working.
Option Explicit
Dim sSiteID, sRegion, sWebSiteName, sOrgName, sIntIPAddress, objAppPools, objApplication
Dim sWebPath, objIIS, strWebID, ObjServerBindings, objWebSite, objPublic
Dim i, ScriptMaps, arrVersions(2), thisVersion, thisScriptMap
sSiteID = "SampleSite"
sRegion = "US"
sIntIPAddress = ""
sWebPath = "C:\\site\\website\\"
'Create Application Pool
Set objAppPools = GetObject("IIS://localhost/W3SVC/AppPools")
Set objAppPools = objAppPools.Create("IIsApplicationPool", sSiteID)
objAppPools.SetInfo
'Create Web Site
set objIIS = GetObject("IIS://localhost/W3SVC")
objServerBindings = Array(0)
objServerBindings(0) = sIntIPAddress & ":" & 80 & ":" & ""
strWebID = objIIS.CreateNewSite(sSiteID, objServerBindings, sWebPath)
WScript.Echo strWebID
'Sets Web Site Properties
set objWebSite = GetObject("IIS://localhost/W3SVC/" & strWebID)
objWebSite.AccessRead = "True"
objWebsite.AccessScript = "True"
'ObjWebsite.AppPoolID = sSiteID
'objWebsite.AppFriendlyName = "Default Application"
objWebSite.SetInfo
Set objApplication = GetObject("IIS://localhost/W3SVC/" & strWebID & "/ROOT")
With objApplication
.AppPoolID = sSiteID
' .AppRoot = "IIS://localhost/LM"
.AppFriendlyName = "Default Application"
.AppIsolated = 1
.AccessRead = True
.AccessExecute = True
.SetInfo
End With
Call Main()
'-----------------------------------
' Name: Main
' Description: Bulk of page is in a subroutine so that we can
' Exit early if desired
'-----------------------------------
Sub Main()
Dim strServer
Dim intSiteID
Dim strVDir
strServer = "localhost"
intSiteID = strWebID
If strVDir <> "" Then
strVDir = "/" & strVDir
End If
Dim strNewVersion
strNewVersion = "v2.0.50727"
Dim strObjPath
Dim objIIS
'make a backup first
Backup(strServer)
strObjPath = "IIS://localhost/W3SVC/" & intSiteID & "/ROOT"
Set objIIS = getObject(strObjPath)
ReplaceScriptMaps objIIS, strNewVersion
Set objIIS = Nothing
End Sub
'-----------------------------------
' Name: ReplaceScriptMaps
' Description: Set the script mappings to the new version
' Inputs: objIIS, strNewVersion
'-----------------------------------
Sub ReplaceScriptMaps(objIIS, strNewVersion)
Dim i, ScriptMaps, arrVersions(2), thisVersion, thisScriptMap
Dim strSearchText, strReplaceText
Select Case Trim(LCase(strNewVersion))
Case "v1.1.4322"
strReplaceText = "v2.0.50727"
Case ""
strReplaceText = "v2.0.50727"
Case Else
strReplaceText = "v2.0.50727"
End Select
ScriptMaps = objIIS.ScriptMaps
arrVersions(0) = "v1.1.4322"
arrVersions(1) = "v2.0.50727"
'Loop through all three potential old values
For Each thisVersion in arrVersions
'Loop through all the mappings
For thisScriptMap = LBound(ScriptMaps) to UBound(ScriptMaps)
'Replace the old with the new
ScriptMaps(thisScriptMap) = Replace(ScriptMaps(thisScriptMap), thisVersion, strReplaceText)
Next
Next
objIIS.ScriptMaps = ScriptMaps
objIIS.SetInfo
WScript.Echo("Set new Script Maps successfully.")
End Sub
'-----------------------------------
' Name: Backup
' Description: Backup the metabase
' Inputs: strServer (friendly name of the version)
'-----------------------------------
Sub Backup(strServer)
Dim objComp
Set objComp = GetObject("IIS://" & strServer)
objComp.Backup "", &HFFFFFFFF, 2
End Sub