A new method has been added to Win32Admin.DLL.
Method: UserSetProps( $Server, $Account, $Properties)
code:
; $Server : "ServerName"
; $Account : "User1"
; $Properties is a string of property and value pairs. "property=value;"
; The "=" and ";" is required for each property/value pair.
; Properties:
; name => 'testuser', (use to rename an account)
; password => 'testpassword',
; home_dir => '\\\\testserver\\testshare',
; comment => 'test users comment',
; flags => numeric,
; script_path => '\\\\testserver\\testshare\\logon_script.bat',
; full_name => 'test users full name',
; usr_comment => 'test users usr comment',
; workstations => 'comp0001,comp0002,comp0003,comp0004,comp0005,comp0006,comp0007,comp0008',
; acct_expires => epoch seconds time() + 3600 * 24,
; logon_hours => a string of 168 1's and/or 0's, each digit represents 1 hour of the 168 hours in a week
; country_code => numeric,
; code_page => numeric,
; primary_group_id => numeric, 513 = "domain users" the RID of the group
; profile => '\\\\testserver\\testshare\\profile_dir',
; home_dir_drive => 'Y:'
;
; The command returns true (1) on success.
;
; Be very careful when modifying account properties. Research each one before use.
;
code:
$Win32Admin = createobject("Win32Admin")
if vartypename($Win32Admin) <> "Object"
? "@serror"
endif
$props = "password=abc123;" +
"full_name=John Smith;" +
"primary_group_id=513;"
if $Win32Admin.UserSetProps("server1", "user1", $props)
? "properties successfully set"
else
? "UserSetProps failed: @serror"
endif
The updated DLL can be downloaded from my website.
[ 27. November 2002, 06:31: Message edited by: Howard Bullock ]