Reputation: 47
I have a script that when utilized will allow someone to change the password of a user. It uses the below command to do this.
dsquery user -samid $username | dsmod user -pwd Password -mustchpwd yes
The only issue with this is that you have to have Active Directory in order to use this command. To access the script I utilize my network U: drive and just call a shortcut to that shared drive. However when I switch to a computer on the network that does not have active directory on it I am unable to use the script. What I am wondering is how do install Active directory onto the shared drive and have the script access active directory through that shared drive so that I can use the script on any computer regardless of whether or not they have active directory?
Upvotes: 0
Views: 511
Reputation: 47
This code worked for me using ADSI
$pwd = "Password"
$user = (([adsisearcher]"(&(objectCategory=User)(samaccountname=$username))").findall()).properties.distinguishedname
$oUser = [adsi]“LDAP://$user”
$ouser.psbase.invoke(“SetPassword”,$pwd)
$ouser.psbase.CommitChanges()
Upvotes: 1