Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Changing Dial-In options for Windows 2000

by tachyon (Chancellor)
on Mar 03, 2003 at 01:00 UTC ( [id://239924]=note: print w/replies, xml ) Need Help??


in reply to Changing Dial-In options for Windows 2000

Do it with VBS. You can automate this by writing a file tmp.vbs executing it and then unlinking it. Here is an example that enables accounts chopped out of one of my AD scripts. You will need to set $TMPVBS, $OU and $DC which are my defined outer scope globals (so shoot me).....

Do an C:\>ldifde -f dump.txt; type dump.txt to see what $OU and $DC should be if you don't know already.

sub enable_accounts { my @usernames = @_; open VBS, ">$TMPVBS" or die "Can't write $TMPVBS $!\n"; print VBS "Dim oContainer\n"; for (@usernames) { my @data = split ','; chomp (my $username = pop @data); print VBS qq' Set oContainer=GetObject("LDAP://CN=$username,$OU,$DC") oContainer.AccountDisabled = False oContainer.SetInfo\n'; } print VBS "\nSet oContainer = Nothing"; close VBS; print "Enabling new accounts....."; `$tmpvbs`; print "Done!\n"; unlink $TMPVBS unless $DEBUG; }

I'll leave it as an exercise for you to find the right property name and what to set it to. Here is a hint I suggest you enumerate the properties and their values.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: Changing Dial-In options for Windows 2000
by iguanodon (Priest) on Mar 03, 2003 at 03:41 UTC
    Well, I never thought of that. Doh!

    This is great for stuff that's hard (or impossible?) with Win32::OLE, as well as quick one-offs.

      Yeah, sometimes you just gotta go with the flow. Bend like a reed in the wind grashopper and use your Perl hammer on a VB nail :-)

      cheers

      tachyon

      s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: Re: Changing Dial-In options for Windows 2000
by meetraz (Hermit) on Mar 03, 2003 at 17:30 UTC
    Why would you suggest 1) Creating a new file 2) Writing VB to that file 3) closing it 4) executing it 5) deleting it .. when you can just do this directly in perl?

    my $oContainer = Win32::OLE->GetObject("LDAP://CN=$username,$OU,$DC"); $oContainer->{AccountDisabled} = 0; # FALSE $oContainer->SetInfo();

    There's really nothing you can do in VBS that you can't do in perl... and using an all-perl solution is faster & safer.

      Cool! ++ As for why. Quick and dirty hack to get the job done leveraging VBS? and (limited) Perl knowledge. Your way is much neater. I just did not know about it at the time when we needed it done yesterday ;-) I have only relatively recently started to use Win32::OLE.

      cheers

      tachyon

      s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found