Difference between revisions of "Password reset windows powershell"

From UVOO Tech Wiki
Jump to navigation Jump to search
(Created page with "# Local user ``` $password = Read-Host -AsSecureString $UserAccount = Get-LocalUser -Name "User02" $UserAccount | Set-LocalUser -Password $password ``` # AD ``` $password = (...")
 
 
Line 12: Line 12:
  
 
```
 
```
 +
 +
# Refs
 +
- https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.localaccounts/set-localuser?view=powershell-5.1
 +
- https://learn.microsoft.com/en-us/powershell/module/activedirectory/set-adaccountpassword?view=windowsserver2022-ps

Latest revision as of 14:49, 14 December 2023

Local user

$password = Read-Host -AsSecureString
$UserAccount = Get-LocalUser -Name "User02"
$UserAccount | Set-LocalUser -Password $password

$password = (Read-Host -Prompt "Provide New Password" -AsSecureString)
Set-ADAccountPassword -Identity foo -Password $password

Refs