Enable NTLM Authentication in IIS (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 NTLM-based authentication for a web site.
# ------ SCRIPT CONFIGURATION ------

use Win32::OLE;

$strComputer = '<ServerName>';
$strSiteID = '<SiteID>';

$intFlag = 4;
# Here are the available authentication values:
#     1 = Anonymous
#     2 = Basic
#     6 = MD5
#     4 = NTLM
#    64 = Passport
# For the intFlag variable, simply add together the
# numbers that represent the auth settings you want
# to configure.
# ------ END CONFIGURATION ---------

$objWebSite = Win32::OLE->GetObject('IIS://' . $strComputer . '/W3SVC/' . $strSiteID);
$objWebSite->{AuthFlags} = $intFlag;
$objWebSite->SetInfo();
print 'Successfully modified auth settings for: ' . $objWebSite->ServerComment, "\n";

This code has been viewed 1982 times.

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