Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

LimitLoginWrite

by Anonymous Monk
on Mar 01, 2006 at 02:51 UTC ( #533572=sourcecode: print w/replies, xml ) Need Help??
Category: Win32 Stuff
Author/Contact Info lowlyapprentice@msn.com
Description: A way to configure LimitLogin for 2003 Servers remotely through perl. Special Thanks to Toby Everett for the crash course in VBscript -> Perl Conversion.
 sub WriteLimit {
         my $self=shift;     
         my $User = "Administrator";
         my $Password = "y0m0mmaf00"; #Password Changed to protect the
+ innocent
         my $dso1 = Win32::OLE->GetObject("LDAP:");
         my $LimitDN = "LDAP://$self->{ServerIP}/DC=LimitLogin,$self->
+{ServerDN}";
         my $obj2 = $dso1->OpenDSObject($LimitDN,$User,$Password,0x201
+); 
         my $LimitLogin = $obj2->Create("msLimitLoginUser","cn=$self->
+{Username}");
               $LimitLogin->Put('msLimitLoginUsername',"$self->{Name}"
+);
               $LimitLogin->Put('msLimitLoginDenyLoginOnQuotaExceed', 
+'TRUE');
               $LimitLogin->Put('msLimitLoginQuota' ,1);
               $LimitLogin->SetInfo();
         my $LLogin = Win32::OLE->new("LLoginPerm.clsDSPermissions");
         my $SchemaGUID = $LLogin->FlipOctetGuidToTextGuid("CN=Schema,
+CN=Configuration,$self->{ServerDN}");
         my  $strResult = $LLogin->fSetLLoginDSPermission($LimitLogin-
+>{distinguishedname},$SchemaGUID, $self->{Domain},$LimitLogin->{CN});

}
Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://533572]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2020-09-22 21:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (130 votes). Check out past polls.

    Notices?