To set a new password using PowerShell, follow these steps:
1. **Open PowerShell:**
- Press `Windows + X` and select `Windows PowerShell` (Admin) from the menu.
2. **Check PowerShell Version:**
- Ensure you are using PowerShell 5.1 or later by typing `$PSVersionTable.PSVersion`.
3. **Import Active Directory Module:**
- Run `Import-Module ActiveDirectory` to load the necessary Active Directory module.
4. **Set New Password:**
- Use the `Set-ADAccountPassword` cmdlet:
```
Set-ADAccountPassword -Identity 'username' -Reset -NewPassword (ConvertTo-SecureString 'NewPassword123!' -AsPlainText -Force)
```
- Replace `'username'` with the actual username and `'NewPassword123!'` with the desired password.
5. **Enable the Account:**
- If needed, enable the account using:
```
Enable-ADAccount -Identity 'username'
```
6. **Force Password Change at Next Logon (Optional):**
- Run:
```
Set-ADUser -Identity 'username' -PasswordNeverExpires $false
```
7. **Verify Password Change:**
- Confirm the password change by attempting to log in with the new credentials.
**Note:** Ensure you have the necessary administrative privileges to perform these actions.
Comments
0 comments
Please sign in to leave a comment.