All versions
Here is a simple way how an existing user can change the password for his account. The user must know his old password and does not need Administrator privileges. Make sure you change the user details at the beginning of this script:
$username = 'yourUserName' $domain = 'test.lab' $oldPassword = 'OldPassword' $newPassword = 'NewPassword' $sourceCode = @' [DllImport("netapi32.dll", CharSet = CharSet.Unicode)] public static extern bool NetUserChangePassword(string domain, string username, string oldpassword, string newpassword); '@ Add-Type -MemberDefinition $sourceCode -Name 'Api' -Namespace 'Win32' [Win32.API]::NetUserChangePassword($domain, $username, $oldPassword, $newPassword)