Hi all,
I'm not too familiar with ADSI yet, and can't find an answer to the following issue;
I need to create a local user account on all NT based systems in the domain (NT4 & 2000 clients):
Username: Test
Full Name: Test account
Description: Local account for testing purposes
Password: secret
The account must only have flags set for 'User cannot change password' and 'Password never expires'. The account also must be part of the local administrators group.
I've downloaded the ADSI SDK, helpfiles, and browsed through the forum, but can't seem to get it though. This is all I've got so far:
(by the way; account name, password, description etc are fake, but show what I need to do)
code:
; User to create
$UserName = "Test"
; Password to set for the user
$UserPass = "secret"
; Computername to create the account on
$TargetPC = "TESTNAME"
; Bind to the remote machine
$Object = GetObject("WinNT://$TargetPC")
; Create the user on the remote machine
$Create = $Object.Create("User",$UserName)
; Set the password for the user
$Create.SetPassword($UserPass)
; Apply changes currently in cache
$Create.SetInfo
; Disable the User Must Change Password at Next Logon flag (value 0 = off, 1 = on)
$Create.PasswordExpired = 0
; Apply changes currently in cache
$Create.SetInfo
Exit
Who can help me with this? And where can I find a website where I can learn how to figure these things out for myself? In laymen terms that is..?
Thanks for the help!
_________________________
Regards, Jeroen.
There are two ways to write error-free programs. Only the third one works.