OpenDSObject Secure Inputbox (Perl)

This code can be found in Chapter 20 of Active Directory, 3rd Edition

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.

# From the book "Active Directory, Third Edition" 
# ISBN: 0-596-10173-2

use Win32::OLE;

use constant ADS_SECURE_AUTHENTICATION => 1;
use constant ADS_USE_ENCRYPTION => 2;

my $strPath;
# path to authenticate to in the directory service
my $strUsername;
# DN of the username
my $strPassword;
# plain-text password
my $objNamespaceLDAP;
# ADSI namespace object
my $objMyObject;
# root object of the directory

$strPath = 'LDAP://dc=amer,dc=mycorp,dc=com';
$strUsername = 'cn=Administrator,cn=Users,dc=amer,dc=mycorp,dc=com';
$strPassword = 
#### Error: Haven't yet implemented function inputbox
inputbox;

$objNamespaceLDAP = Win32::OLE->GetObject('LDAP:');
$objMyObject = $objNamespaceLDAP->OpenDSObject($strPath, $strUsername, $strPassword, ADS_USE_ENCRYPTION + ADS_SECURE_AUTHENTICATION);

This code has been viewed 1249 times.

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