Configure web permissions (Perl)

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 Perl code from this site.

# This code configures web permissions on a web site.
# ------ SCRIPT CONFIGURATION ------

use Win32::OLE;

$strComputer = '<ServerName>';
# e.g. web01
$strSiteID = '<SiteID>';
# e.g. 1
# ------ END CONFIGURATION ---------
$objWebSite = Win32::OLE->GetObject('IIS://' . $strComputer . '/W3SVC/' . $strSiteID);
$objWebSite->{AccessRead} = 1;
$objWebSite->{AccessWrite} = 1;
$objWebSite->{AccessSource} = 1;
$objWebSite->{AccessScript} = 0;
$objWebSite->{AccessExecute} = 0;
$objWebSite->SetInfo();
print 'Successfully modified permissions for web site: ' . $objWebSite->ServerComment, "\n";

This code has been viewed 790 times.

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