Welcome to Aaron Thompson's Page Wednesday, August 20 2014 @ 19:26 CDT  
Personal
Contact Info
Family
Resume
 
Development
CGI
probability project
 
Perl Modules
Win32::AD::User (cpan)
 
Shell
backup_file (source)
chkconfig (source)
gen-autohome (source)
group-utils (source)
mail-deny (source)
mail-logs (source | archive)
mailman-qmail (source)
qmail vacation (source)
 
Links
Beast of Burden LLC
Central Iowa LUG
CedarLUG
CedarvalleyPM
ITS-IS Home
ITS Home
UNI Home
 
 

Name

Win32::AD::User

Synopsis
 use Win32::AD::User;

 $user = AdUser->new( ADS_CONNECT_STRING, USER_REFERENCE_STRING );

 $user->print_me();

 $user->create_new();

 $user->get_info();

 $user->lock();

 $user->un_lock();

 $user->is_locked();

 $user->set_properties( PROPERTY_HASH );

 $user->set_property( ADS_PROPERTY_NAME, PROPERTY_VALUE );

 $user->get_properties( ADS_PROPERTY_LIST );
 
 $user->get_property( ADS_PROPERTY_NAME );
 
 $user->delete();

 $user->set_password( PASSWORD_STRING );

 $user->rename( USER_REFERENCE_STRING );

 $user->move( ADS_CONNECT_STRING );

 $user->get_groups();

 $user->add_to_group( ADS_GROUP_STRING );

 $user->remove_from_group( ADS_GROUP_STRING );

 $user->get_ou_member_list( SEARCH_MASK );
Abstract

Administer user in Active Directory using either LDAP or WinNT AdsPath.

Description

Connect to an Active Directory (AD) Server and Administer Users. Below there is more information on each of the various functions of an Win32::AD::User object.

new();

The new function returns an Win32::AD::User object. The function takes 2 scalars; ADS_CONNECT_STRING and USER_REFERENCE_STRING. The ADS_CONNECT_STRING can be a valid LDAP or WinNT ADsPath string. More information about a valid ADsPath String is available via the Win32::OLE documentation. The USER_REFERENCE_STRING is the username of the account you would like to either create or modify.

print_me();

The print_me function will print the value of all object properties.

create_new();

The 'create_new' function will create a new user object on the AD Server. The 'new' function does not actualy connect to the AD Server either 'create_new or 'get_info' must be used to connect to the AD Server properly.

get_info();

The 'get_info' function will get the user information from the AD Server. The 'new' function does not actualy connect to the AD Server either 'create_new or 'get_info' must be used to connect to the AD Server properly.

lock();

The 'lock' function will lock a user account.

un_lock();

The 'un_lock' function will unlock a user account.

is_locked();

The 'is_locked' function returns '0' if the account is not locked and '1' if it is locked.

set_properties();

The 'set_properties' function will set all properties sent in as PROPERTY_HASH. PROPERTY_HASH is a hash where every key is a valid ADS_PROPERTY_NAME and that key's value is a valid PROPERTY_VALUE. Both of which are define in the 'set_property' function.

set_property();

The 'set_property' function will allow you to set any user property. The function take two scalars ADS_PROPERTY_NAME, and PROPERTY_VALUE. ADS_PROPERTY_NAME is the name of the property as defined in the ADSI Specification. The ADSI Browser by Toby Everett is a great tool for figuring out which ADS_PROPERTY_NAME you want to use. The PROPERTY_VALUE is what you would like to store in AD.

get_properties();

The 'get_properties' function will return a hash of elements where every key is an element from the ADS_PROPERTY_LIST that is sent is to the funciton as the only argument. The ADS_PROPERTY_LIST is a list of ADS_PROPERTY_NAME elements, as defined in the 'set_property' function description.

get_property();

The 'get_property' function returns a scalar that is the value of the ADS_PROPERTY_NAME which is sent in as an argument. The ADS_PROPERTY_NAME is defined in the 'set_property' function description.

delete();

The 'delete' function will delete the user object from the AD Server. Note that this will not destroy any other data in the Win32::AD::User object, you can recreate user account (without any of the previous attiributes) by invoking the 'create_new' function after using the 'delete' function.

set_password();

The 'set_password' function will set the password of the user. This function requires one scalar; PASSWORD_STRING. This string is what will become the user's password.

rename();

The 'rename' function will change the user's name from whatever it is to the value supplied as USER_REFERENCE_STRING. USER_REFERENCE_STRING is defined in the 'new' function description.

move();

The 'move' function will change the user's location in AD. The function requires an ADS_CONNECT_STRING. The ADS_CONNECT_STRING is defined in the 'new' function description.

get_groups();

The 'get_groups' function will return a list of groups of which the user is a member.

add_to_group();

The 'add_to_group' function will add the user to the group specified in the ADS_GROUP_STRING. The ADS_GROUP_STRING is an ADS_CONNECT_STRING for a group object. The ADS_CONNECT_STRING is defined in the 'new' function description. If a full ADS_GROUP_STRING is given it will attempt to build a WinNT:// ADS_CONNECT_STRING for your user and group (based on the string supplied) to perform the user's addition to the group.

remove_from_group();

The 'remove_from_group' function will remove the user from the group specified in the ADS_GROUP_STRING. The ADS_GROUP_STRING is an ADS_CONNECT_STRING for a group object. The ADS_CONNECT_STRING is defined in the 'new' function description. If a full ADS_GROUP_STRING is given it will attempt to build a WinNT:// ADS_CONNECT_STRING for your user and group (based on the string supplied) to perform the user's removal from the group.

get_ou_member_list( SEARCH_MASK );

The 'get_ou_member_list' function will return a list of objects in the OU given as your ADS_CONNECT_STRING. Note, this will only work for an LDAP:// ADS_CONNECT_STRING. SEARCH_MASK refers to a string that will be use to filter the list of objects returned. For example if you only are intrested in CN objects use the mask "CN=". The SEARCH_MASK is case sensitive.


Report a Bug

If you find a bug please let me know email me at thompson@cns.uni.edu.

Download

Copyright (C) 2003 Aaron Thompson
thompson@cns.uni.edu

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Click here to download the script