Disable Password Expiration with PowerShell

Are you trying to disable password expiration with PowerShell?

This guide is for you.

Sometimes, Windows users find it annoying to change passwords frequently.

One of the methods to prevent this is using PowerShell for disabling the expiration of passwords on Windows servers.

Password expiration is a feature in Windows that forces a local account on the PC to change their passwords when a specified maximum (42 days by default) and minimum ( 0 days by default) password age has been reached.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform Windows related tasks.

In this context, we shall look into how to disable the password expiration on Windows.

Steps to Disable Password Expiration with PowerShell:

Windows PowerShell is a powerful tool for automating tasks and simplifying configuration and can be used to automate almost any task in the Windows ecosystem, including active directory and exchange.

Also, it is a popular tool among sysadmins and experienced Windows users.

Here, you will learn the right steps to disable password expiration with PowerShell.

1. Firstly, we will go to Administrative Tools

2. Then click on Active Directory Module for Windows PowerShell.

3. After that we can import the Active Directory module in Powershell.

And running the PowerShell script will prevent the domain password from expiring again.

4.For instance if we have a domain account we can replace PCunlocker with the domain account.

PCUnlocker is a bootable utility that allows us to bypass or reset forgotten passwords.

Generally, we use this to reset administrator or other user passwords.

5. Finally, we will use the following command for disabling password expiration:

Set-LocalUser -Name "pcunlocker" -PasswordNeverExpires 1

Therefore, this command prevents passwords from expiring.

[ Need urgent assistance to fix Windows related errors? – We can help you. ]


This article will guide you on the method to disable password expiration in the #Windows server with PowerShell.

#PowerShell is the shell #framework developed by Microsoft for administration tasks such as configuration management and automation of repetitive jobs. 

The term 'PowerShell' refers to both – the shell used to execute commands and the scripting language that goes along with the framework.

Why did #Microsoft make me change my password?

This is a security feature of all Microsoft accounts which cannot be turned off. 

If the option for 72 days password expiration is enabled in your account then it will automatically ask you to reset password.

To turn off the password feature on Windows 10:

1. Click the Start menu and type "netplwiz." The top result should be a program of the same name — click it to open.

2. In the User Accounts screen that launches, untick the box that says "Users must enter a name and password to use this computer."

3. Hit "Apply."

4. When prompted, re-enter your password to confirm the changes.

For Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on LinuxAPT.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com