Publish a share in Active Directory (Perl)
This code can be found in
Chapter 8 of Windows XP 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.
# From the book "Windows XP Cookbook"
# ISBN: 0596007256
# ------ SCRIPT CONFIGURATION ------
use Win32::OLE;
$strComputer = 'ad-01';
# name of a domain controller
$strShareName = 'Perl Libraries';
$strSharePath = '\\\\fs01\\perl-libs';
$strShareDescr = 'Core Perl libraries';
$objRootDSE = Win32::OLE->GetObject('LDAP://' . $strComputer . '/RootDSE');
$strParentDN = '/OU=SharedFolders,' . $objRootDSE->Get('defaultNamingContext');
# ------ END CONFIGURATION ---------
$objOU = Win32::OLE->GetObject('LDAP://' . $strComputer . $strParentDN);
$objVol = $objOU->Create('volume', 'cn=' . $strShareName);
$objVol->Put('uncName', $strSharePath);
$objVol->Put('Description', $strShareDescr);
$objVol->SetInfo();
print 'Successfully created object: ' . $objVol->Name, "\n";
|
This code has been viewed 886 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|