Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

LimitLoginWrite

by Anonymous Monk
on Mar 01, 2006 at 02:51 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: sourcecode [id://533572]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 05:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found