Попробуйте этот VBScript ... Я думаю, он будет делать то, что вам нужно.Просто сохраните его в файле .vbs (вначале измените массивы для своих сайтов и расширений) и из CommandPrompt в папке System32 запустите «cscript yourfile.vbs».
Надеюсь, это поможет (и работает:)) У меня есть IIS7, поэтому я не смог полностью протестировать в IIS6.Дайте мне знать, если у вас возникнут проблемы, и я постараюсь их исправить.
Да, и спасибо @Cheeso за некоторый код, который я "позаимствовал" у его вопроса .
Dim arrExtensions(2)
arrExtensions(0) = ".tst1"
arrExtensions(1) = ".tst2"
arrExtensions(2) = ".tst3"
Dim arrSites(1)
arrSites(0) = "Default Web Site"
arrSites(1) = "Test"
Dim iis
iis = GetObject("winmgmts://localhost/root/MicrosoftIISv2")
For s = 0 To ubound(arrSites)
' Get the settings for this web site '
iisSettings = iis.ExecQuery("SELECT * FROM IIsWebServerSetting WHERE ServerComment = '" & arrSites(s) & "'")
For e = 0 To ubound(arrExtensions)
ReDim newMaps(0)
' two passes '
For t = 0 To 1
Dim c
c = 0
For Each item In iisSettings
' in pass 1, count them. '
' in pass 2, copy them. '
For i = 0 To Ubound(item.ScriptMaps)
If UCase(item.ScriptMaps(i).Extensions) <> ucase(arrExtensions(e)) Then
If t = 1 Then
newMaps(c) = item.ScriptMaps(i)
End If
c = c + 1
End If
Next
If t = 0 Then
ReDim Preserve newMaps(c)
Else
newMaps(c) = iis.get("ScriptMap").SpawnInstance_()
newMaps(c).Extensions = arrExtensions(e)
newMaps(c).ScriptProcessor = "%Windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"
newMaps(c).Flags = "1"
newMaps(c).IncludedVerbs = "ALL"
item.ScriptMaps = newMaps
item.Put_()
End If
Next
Next
Next
Next
iisSettings = Nothing
iis = Nothing