Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Change Dial-In Status in AD

by jds (Acolyte)
on Mar 10, 2003 at 15:46 UTC ( [id://241750]=sourcecode: print w/replies, xml ) Need Help??
Category: Win32 Stuff
Author/Contact Info John Shearer (jds@jkshearer.com)
Description: After some discussion on how to do this, here is a small script to programmatically change the Dial-In status of a user in Active Directory (this is the 'Remote Access Permission' on the 'Dial-In' tab from AD Users & Computers). You would of course enumerate a group or have some other list of users in order to make mass changes. Also, despite earlier problems I have had, OLE is now my friend!
#!win32-perl 
use strict;
$|++;

use Win32::OLE;

# Change Dial-In Status for a user
# 20030308 - JDS
# Version:  0.2a

# The DC for the LDAP string
my $ldapdc = "DC=nmh,DC=nmhschool,DC=org";

# OU of the user(s) you want to change
my $ou = "IT";

# User name you want to change - likely will be enumerated from a grou
+p
my $user = "JShearer";

# The Dial-In Status - either True or False depending on whether you w
+ant to Allow or Deny
my $status = 'TRUE';

my $oContainer = Win32::OLE->GetObject("LDAP://CN=$user,OU=$ou,$ldapdc
+");
$oContainer->{msNPAllowDialin} = $status;
$oContainer->SetInfo();

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: sourcecode [id://241750]
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-03-28 15:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found