Skip to content

Instantly share code, notes, and snippets.

@Cyr-Az
Cyr-Az / Set-LocalUserPassword.ps1
Created November 21, 2025 17:03
Changes the password of any local user account using its current password for verification without requiring administrator permissions
Function Set-LocalUserPassword
{
<#
.SYNOPSIS
Changes the password of any local user account using its current password for verification.
.DESCRIPTION
This function utilizes the System.DirectoryServices.AccountManagement .NET namespace to change a local user's password.
Unlike the standard 'Set-LocalUser' cmdlet or 'net user' command, this function utilizes the 'ChangePassword' method.