Book HomeJava and XSLTSearch this book

22.10. Win32::NetAdmin

The Win32::NetAdmin module provides extensive functionality for administering users and groups on Windows NT servers. This module does not implement an object interface for administration; it exports several functions that execute administrative commands. (This module does not load on Windows 95 systems.)

The following functions are provided by the Win32::NetAdmin module. The server argument of each function is optional; however, a placeholder for the argument must be used if you don't supply a name. An empty string ("") will work, indicating that the local machine should be used.

GetDomainController

GetDomainController (server, domain, $name)

Returns the name of the domain controller for the specified serverand domain to the variable $name.

GroupAddUsers

GroupAddUsers (server, name, users)

Adds users to group name on server. userscan be a list of usernames or a list variable containing multiple usernames.

GroupCreate

GroupCreate (server, name, comment)

Creates a group with the specified name on server. commentis a string used to provide a description about the group.

GroupDelete

GroupDelete (server, name)

Deletes a group named name from server.

GroupDeleteUsers

GroupDeleteUsers (server, name, users)

Deletes a list of users from the group name on server.

GroupGetAttributes

GroupGetAttributes (server, name, comment)

Returns the comment for group name on server to the variable comment.

GroupGetMembers

GroupGetMembers (server, name, $users)

Returns the usernames that are members of group name on serverto the array referenced by users.

GroupIsMember

GroupIsMember (server, name, user)

Queries group name on server to see if user is a member. Returns true if user is a member, false if not.

GroupSetAttributes

GroupSetAttributes (server, name, comment)

Sets the comment for group name on server to the string provided in comment.

LocalGroupAddUsers

LocalGroupAddUsers (server, name, users)

Adds users to local group name on server. userscan be a list of usernames or a list variable containing multiple usernames.

LocalGroupCreate

LocalGroupCreate (server, name, comment)

Creates a local group with the specified name on server. comment is a string used to provide a description about the group.

LocalGroupDelete

LocalGroupDelete (server, name)

Deletes a local group named name from server.

LocalGroupDeleteUsers

LocalGroupDeleteUsers (server, name, users)

Deletes a list of users from the local group name on server.

LocalGroupGetAttributes

LocalGroupGetAttributes (server, name, $comment)

Returns the comment for local group nameon server to the variable $comment.

LocalGroupGetMembers

LocalGroupGetMembers (server, name, \@users)

Returns the usernames that are members of local group name on serverto the array referenced by users.

LocalGroupIsMember

LocalGroupIsMember (server, name, user)

Queries local group name on server to see if user is a member. Returns true if user is a member, false if not.

LocalGroupSetAttributes

LocalGroupSetAttributes (server, name, comment)

Sets the comment for local group name on server to the string provided in comment.

UserCreate

UserCreate (server, username, password, passwordage, privilege, 
homedir, comment, flags, scriptpath)

Creates a new user with the specified settings:

server
Name of the server

username
Name of new user

password
The user's password

passwordage
Amount of time before password expires

privilege
Privilege settings of the new user, which can be one of the following:

USER_PRIV_MASK 
USER_PRIV_GUEST 
USER_PRIV_USER 
USER_PRIV_ADMIN
homedir
Pathname of the user's home directory

comment
A string containing a comment about the user

flag
A flag containing user creation settings, which can be one of the following:

UF_TEMP_DUPLICATE_ACCOUNT 
UF_NORMAL_ACCOUNT 
UF_INTERDOMAIN_TRUST_ACCOUNT 
UF_WORKSTATION_TRUST_ACCOUNT 
UF_SERVER_TRUST_ACCOUNT 
UF_MACHINE_ACCOUNT_MASK 
UF_ACCOUNT_TYPE_MASK 
UF_DONT_EXPIRE_PASSWD 
UF_SETTABLE_BITS 
UF_SCRIPT 
UF_ACCOUNTDISABLE 
UF_HOMEDIR_REQUIRED 
UF_LOCKOUT 
UF_PASSWD_NOTREQD 
UF_PASSWD_CANT_CHANGE
scriptpath
Pathname for the user's login script

UserDelete

UserDelete (server, username)

Deletes a user with username from server.

UserGetAttributes

UserGetAttributes (server, username, $password, $passwordage, $privilege, $homedir, $comment, $flags, $scriptpath)

Retrieves information from a user profile for the user identified by username on server and stores each piece in the corresponding variables you provide as arguments. The elements and order of user information are the same as described in the UserCreate function.

UserSetAttributes

UserSetAttributes (server, username, password, passwordage, privilege, homedir, comment, flags, scriptpath)

Sets attributes for user username on server. The attributes are those described for the UserCreate function.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.