Configure virtual directory web permissions (VBScript)

This code can be found in Chapter 15 of Windows Server 2003 Security Cookbook

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' This code configures web permissions on a virtual directory.
' ------ SCRIPT CONFIGURATION ------
strComputer = "<ServerName>"  'e.g. web01
strSiteID = "<SiteID>"        'e.g. 1
strVdir = "<VdirPath>"        'e.g. Root/employees
' ------ END CONFIGURATION ---------
set objWebSite = GetObject("IIS://" & strComputer & "/W3SVC/" & strSiteID)
set objVdir = objWebSite.GetObject("IISWebVirtualDir",strVdir)
objVdir.AccessRead = True
objVdir.AccessWrite = True
objVdir.AccessSource = True
objVdir.AccessScript = False
objVdir.AccessExecute = False
objVdir.SetInfo
WScript.Echo "Successfully modified permissions for virtual directory: " & _
             objVdir.Name

This code has been viewed 2034 times.

New from the creators of TechTasks.com: StatSheet.com