Posted in
Windows Powershell |
No Comment | 4,049 views | 24/04/2009 19:14
You can change windows users password with this function:
1
2
3
4
5
6
7
8
| # Change Windows User Password
function change_password($username, $password)
{
$user = [adsi]("WinNT://localhost/$username, user")
$change = $user.psbase.invoke("SetPassword", "$password")
}
change_password "$username" "$password" |
# Change Windows User Password
function change_password($username, $password)
{
$user = [adsi]("WinNT://localhost/$username, user")
$change = $user.psbase.invoke("SetPassword", "$password")
}
change_password "$username" "$password"
You should call function with 2 parameters named $username and $password.