$UserName = "NazwaUżytkownika"
# Zastąp "NazwaUżytkownika" właściwą nazwą użytkownika
$UserPassword = ""
$NewPassword = ConvertTo-SecureString -String "$UserPassword" -AsPlainText -Force
# Zastąp "NoweHasło" właściwym nowym hasłem
$User = Get-LocalUser -Name $UserName
if ($User) {
$User | Set-LocalUser -Password $NewPassword
Write-Host "Password changed $UserName."
} else {
Write-Host "Password not changed, $UserName."
}
$UserName = "UserName" # Replace "UserName" with the actual username
$SecurePassword = Read-Host -Prompt "Enter the new password" -AsSecureString
$User = Get-LocalUser -Name $UserName
if ($User) {
$User | Set-LocalUser -Password $SecurePassword
Write-Host "Password successfully changed for the account $UserName."
} else {
Write-Host "Account $UserName not found."
}