search
Categories
Archive
Blogroll

Badges

Microsoft PowerShell MVP
MCSE
Sponsors

VirtualMetric
Cozumpark Bilisim Portali
How to change windows user password with Powershell?
Posted in Windows Powershell | No Comment | 2,520 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"

You should call function with 2 parameters named $username and $password.



Leave a Reply