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