iis6 增加过滤器的vbs

iis6addfiltervbs

Dim r32wShell, r32env1 
Set r32wShell = WScript.CreateObject("WScript.Shell")
'判断环境是否是32抑或64位
r32env1 = r32wShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%")

'取当前路径
curpath = createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path


Dim FiltersObj 
Dim FilterObj 
Dim LoadOrder 
Dim FilterName 
Dim FilterPath 
Dim FilterDesc 

FilterName = "phpsirfilter" 
FilterDesc = "phpsir filter" 

If r32env1 <> "x86" Then  
' 32bit phpsirfilter32.dll
FilterPath = curpath + "\phpsirfilter32.dll" 
Else
' 64bit phpsirfilter64.dll
FilterPath = curpath + "\phpsirfilter64.dll" 
End If

'iis 6 增加过滤器
Set FiltersObj = GetObject("IIS://LocalHost/W3SVC/Filters") 
LoadOrder = FiltersObj.FilterLoadOrder 
If LoadOrder <> "" Then 
  LoadOrder = LoadOrder & "," 
End If 
LoadOrder = LoadOrder & FilterName 
FiltersObj.FilterLoadOrder = LoadOrder 
FiltersObj.SetInfo 

Set FilterObj = FiltersObj.Create("IIsFilter", FilterName) 
FilterObj.FilterPath = FilterPath 
FilterObj.FilterDescription = FilterDesc 
FilterObj.SetInfo 



发表评论

邮箱地址不会被公开。 必填项已用*标注