7

How can I check all users in the AD for a blank password? AND Filter them....

I know how to check all user but I can't Filter them...

Here is what I have:

Get-ADUser -Filter * -SearchBase "OU=SomeOU,DC=mydomain,DC=forest,DC=local" | ForEach {
   $_.SamAccountName
   (new-object directoryservices.directoryentry "", ("domain\" + $_.SamAccountName), "").psbase.name -ne $null
   Write-Host ""
}

Now I want to know how to filter the Output...

6

There isn't a way to do that natively.

DS Internals Test-PaswordQuality:

https://github.com/MichaelGrafnetter/DSInternals/blob/master/Documentation/PowerShell/Test-PasswordQuality.md#test-passwordquality

Install-Module -Name DSInternals -Force

There is also a free application here that uses DSInternals:

https://thycotic.com/solutions/free-it-tools/weak-password-finder/

6

You can find users where PasswordLastSet is null:

Get-ADUser -Filter * -SearchBase "OU=SomeOU,DC=mydomain,DC=forest,DC=local" -Properties PasswordLastSet | where { $_.PasswordLastSet -eq $null}
  • Does this exclude users which had an initial password set when created but never changed it (e.g. because they haven't logged in yet)? – Maz Aug 14 at 11:12
  • Yes, when you create a user and set an initial password, the PasswordLastSet attribute is updated, and not null. However, if the user must change his password at next logon, this attribute will be null too ! – Swisstone Aug 14 at 15:40
  • Alright, thanks! – Maz Aug 14 at 15:43
1

You could use the following the get the results with a True or False, stating that the users has a blank password or not:

Get-ADUser -Filter * -SearchBase "OU=someOU,DC=your,DC=domain" | ForEach {    $_.SamAccountName    (new-object directoryservices.directoryentry "", ("domain\" + $_.SamAccountName), "").psbase.name -ne $null    Write-Host "" }
New contributor
Gn0m3 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.