Perfect... Thanks Richard. The new Perl below works like a charm as well
as the VBScript. Great work.

-----Original Message-----
From: Puckett, Richard [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, October 03, 2002 3:23 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [ActiveDir] Joining computers to a domain?



Picky, picky, picky... *grin*.  Here is it in VBS (and a little cleaner
Perl
below it).

Richard


--------------------------------------------------------------

' VBS ms-DS-MachineAccountQuota Modifier 
Option Explicit
On Error Resume Next

Dim DSO, DSBind, strDS, strDC, strPath, strUsr, strPwd, IntVal

strDC = "domaincontrollername"
strPath = "dc=mycompanyname,dc=com"
strUsr = "DOMAIN\userid"
strPwd = "password"
IntVal = 30

strDS = "LDAP://"; & strDC & "/" & strPath

Set DSO = GetObject("LDAP:")
Set DSBind = DSO.OpenDSObject(strDS, strUsr, strPwd, 1)

DSBind.Put "ms-DS-MachineAccountQuota", IntVal
DSBind.SetInfo

If Err.Number = 0 Then
        WScript.Echo "Successfully reset the quota value"
Else
        WScript.Echo "Doh!: " & Err.Number & ": " & Err.Description
End If

--------------------------------------------------------------

# PERL ms-DS-MachineAccountQuota Modifier 
use strict;
use Win32::OLE 'in';
use Win32::OLE::Const 'Active DS Type Library';

$Win32::OLE::Warn = 3;

# domain, access & quota variables
my $usr = 'DOMAIN\userid';
my $pwd = 'password';
my $dse = 'dc=mycompanyname,dc=com';
my $srv = 'domaincontrollername';
my $val =  '30'; 

&mod_quota($srv, $dse, $usr, $pwd, $val);
exit;


# modify the ms-DS-MachineAccountQuota value
#---------------------------------------------------------
sub mod_quota {
#---------------------------------------------------------

        my ($adc, $adspath, $admact, $passwd, $newval) = @_;

        my $DSO = Win32::OLE->GetObject("LDAP:");
        my $DSBind = $DSO->OpenDSObject("LDAP://".$adc."/".$adspath, 
                          $admact, 
                                    $passwd, 
                          ADS_SECURE_AUTHENTICATION);

        $DSBind->{'ms-DS-MachineAccountQuota'} = $newval;
        $DSBind->SetInfo();
}


--------------------------------------------------------------



> -----Original Message-----
> From: Sullivan, Kevin [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, October 03, 2002 2:54 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [ActiveDir] Joining computers to a domain?
> 
> 
> That's great Richard. I would still like to see the VBScript 
> though. Any for Jscript or Python?
> 
> -----Original Message-----
> From: Puckett, Richard [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, October 03, 2002 2:40 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [ActiveDir] Joining computers to a domain?
> 
> 
> 
> Dunno if this is useful for anyone, but here it is in Perl...
> 
> Regards,
> Richard
> 
> 
> use strict;
> use Win32::OLE 'in';
> use Win32::OLE::Const 'Active DS Type Library'; $Win32::OLE::Warn = 3;
> 
> # domain, access & quota variables
> my $usr = 'DOMAIN\userid';
> my $pwd = 'password';
> my $dse = 'dc=mycompanyname,dc=com';
> my $srv = 'domaincontrollername';
> my $val =  '30'; 
> 
> &mod_quota($srv, $dse, $usr, $pwd, $val);
> exit;
> 
> # modify the ms-DS-MachineAccountQuota value
> #---------------------------------------------------------
> sub mod_quota {
> #---------------------------------------------------------
>       my $adc = shift;
>       my $adspath = shift;
>       my $admact = shift;
>       my $passwd = shift;
>       my $newval = shift;
>               
>       my $DSO = Win32::OLE->GetObject("LDAP:");
>       my $DSBind = $DSO->OpenDSObject("LDAP://".$adc."/".$adspath, 
>                         $admact, 
>                           $passwd, 
>                         ADS_SECURE_AUTHENTICATION);
> 
>       $DSBind->{'ms-DS-MachineAccountQuota'} = $newval;
>       $DSBind->SetInfo();
> }
> 
> 
> 
> 
> 
> > -----Original Message-----
> > From: Sullivan, Kevin [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, October 03, 2002 1:48 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [ActiveDir] Joining computers to a domain?
> > 
> > 
> > I tried to post the swynk script and it didn't send. From
> > past experience it will probably show up in a while. Anyway, 
> > I couldn't get the script that Tony mentioned to run. Can 
> > someone put their eyes on the script and let me know if you 
> > see any problems or lines that I may need to edit.
> > 
> > Thanks,
> > 
> > Kevin
> > 
> http://www.swynk.com/friends/policht/103101.asp
> List info   : http://www.activedir.org/mail_list.htm
> List FAQ    : http://www.activedir.org/list_faq.htm
> List archive: 
> http://www.mail-archive.com/activedir%> 40mail.activedir.org/
> 
> List info   : 
> http://www.activedir.org/mail_list.htm
> List FAQ    : http://www.activedir.org/list_faq.htm
> List archive: 
> http://www.mail-archive.com/activedir%> 40mail.activedir.org/
> 
> List info   : 
> http://www.activedir.org/mail_list.htm
> List FAQ    : http://www.activedir.org/list_faq.htm
> List archive: 
> http://www.mail-archive.com/activedir%> 40mail.activedir.org/
> 
List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive:
http://www.mail-archive.com/activedir%40mail.activedir.org/
List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to