Would you like to learn how to prevent a local user from changing the password using Powershell? In this tutorial, we are going to show you how to remove the password change permission of a local account on a computer running Windows.

• Windows 2012 R2
• Windows 2016
• Windows 2019
• Windows 10

Equipment list

Here you can find the list of equipment used to create this tutorial.

This link will also show the software list used to create this tutorial.

Related tutorial - PowerShell

On this page, we offer quick access to a list of tutorials related to PowerShell.

Tutorial Powershell - Prevent a local user from changing the password

As an Administrator, start an elevated Powershell command-line.

Windows 10 - powershell elevated

List the local user accounts.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Change the password of a local user account.

Copy to Clipboard

Prevent the user from changing the password.

Copy to Clipboard

Optionally, set the password to never expire.

Copy to Clipboard

Verify the account properties.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

In our example, we prevented a local account named GOHAN to change the password.

Prevent a user from changing the password using WinRM and Powershell.

Copy to Clipboard

Enter a credential with administrative permissions.

Powershell - Administrative credential

Verify if the account was renamed.

Copy to Clipboard

Prevent the local account from changing the password on a remote computer using a stored credential.

Copy to Clipboard

There are multiple ways to use Powershell, WinRM, and a stored credential.

Copy to Clipboard

Congratulations! You are able to prevent a local account from changing the password using Powershell.