Friday, May 1, 2009

Set A Vdir property from VBS

Couldn't find a decent sample online for this functions so heres mine:

Set providerObj = GetObject("winmgmts://localhost/root/MicrosoftIISv2")

'Change Report Server to the VDIR your trying to manage
Set IIsWebVirtualDirObj = providerObj.get("IIsWebVirtualDirSetting='W3SVC/1/Root/ReportServer'")

'Set some properties here, notice the _
'Where the hell did that come from? Dunno but it works
' List of properties are here http://msdn.microsoft.com/en-us/library/ms525644.aspx
IIsWebVirtualDirObj.Properties_("AuthFlags").Value =1
IIsWebVirtualDirObj.Properties_("AnonymousUserName").Value= "Domain\User"
IIsWebVirtualDirObj.Properties_("AnonymousUserPass").Value = "Password"

'Put it!!!!!! Set it....
IIsWebVirtualDirObj.Put_()

No comments:

Post a Comment