Advertisements
What's New

PowerShell Script – Password Never Expires

Windows PowerShell is Microsoft’s task automation framework, consisting of a command-line shell and associated scripting language built on top of, and integrated with the .NET Framework. PowerShell provides full access to COM and WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems.  That’s the wiki definition…

Let’s get down to business. So I was assigned to find users in Active Directory with the “password never expires” option enable within the user’s account. Which is a big NO! NO! in the IT world.

The best the commandlet (cmdlet) that I know is the Get-QADUserGet-QADUser retrieves all users in a domain or container that match the specified conditions. The cmdlet has many parameters, which you could view here.

This blog I will only go over -SerachRoot, -PasswordNeverExpires, Format-Table, and the Out-Fileparameters. Getting Dirty!, so this is not the best way to do it and I know there are other ways to do it, but this worked for me like a charm. I would like to know what others have done to get “Password Never Expires” users in Active Directory.

PowerShell  Script

Get-QADUser -SearchRoot "Location of the OU" -PasswordNeverExpires | Format-Table Name | Out-File Location where you would like to drop the file\passwordNeverExpires.txt

example:

Get-QADUser -SearchRoot "fake.domain.org/Users" -PasswordNeverExpires | Format-Table Name | Out-File D:\powerShell\passwordNeverExpires.txt

Well, that’s it! I would like to know what others have done in the past.

if the blog was helpful. please take the time to +1 it, rate it, comment or subscribe

Advertisements
About BjTechNews (914 Articles)
An IT guy trying to learn everything about technology and sharing it with you all. I'm a blogger and video blogger who highlights daily news in the tech industry, promoting tips and hacks for fellow techies.

Leave a Reply

%d bloggers like this: