2008-08-21 4 views
2

IIS 6.0でアプリケーションプールとWebサイトの作成をスクリプト化する必要があります。私はadsutil.vbsとiisweb.vbsを使用してこれらを作成することができましたが、作成したサイトのASP.NETバージョンを2.0.50727.0に設定する方法はわかりません。VBScript/IIS - 特定のWebサイトのASP.NETバージョンを自動的に設定する方法

理想的には、私はadsutil.vbsを使用してメタベースを更新したいと考えています。これはどうすればいいですか?

答えて

6

あなたはAspnet_regiis.exeにツールを使用してこれを行うことができますADSIの方法

上のパンチに私を打ちます。マシンにインストールされているASP.NETのバージョンごとに、これらのツールの1つがあります。これは、ASP.NET 2.0

%windir%\microsoft.net\framework\v2.0.50727\aspnet_regiis -s W3SVC/[iisnumber]/ROOT 

を設定あなたはおそらくすでにこのことを知っていますが、複数の1.1および2.0を持っている場合、これはASP.NET 1.1

%windir%\microsoft.net\framework\v1.1.4322\aspnet_regiis -s W3SVC/[iisnumber]/ROOT 

を設定し

- あなたはに殻から取り出すことができASP.NETバージョンを変更しているWebサイトを互換性のあるアプリケーションプールに切り替えることを忘れないでください。 ASP.NET 1.1と2.0のサイトは、同じアプリケーションプールに混在しません。

2

Diablo Pupのブログに次のスクリプトpostedが見つかりました。 ADSIの自動化を使用します。 Chris @

'****************************************************************************************** 
' Name: SetASPDotNetVersion 
' Description: Set the script mappings for the specified ASP.NET version 
' Inputs: objIIS, strNewVersion 
'****************************************************************************************** 
Sub SetASPDotNetVersion(objIIS, strNewVersion) 
Dim i, ScriptMaps, arrVersions(2), thisVersion, thisScriptMap 
Dim strSearchText, strReplaceText 

Select Case Trim(LCase(strNewVersion)) 
    Case "1.1" 
    strReplaceText = "v1.1.4322" 
    Case "2.0" 
    strReplaceText = "v2.0.50727" 
    Case Else 
    wscript.echo "WARNING: Non-supported ASP.NET version specified!" 
    Exit Sub 
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 ASP.NET version to " & strNewVersion & " successfully.------->" 
End Sub