Skip to content

Instantly share code, notes, and snippets.

@pkskelly
Last active May 17, 2019 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkskelly/f9e396ff96898ea99af53da87cab1b6a to your computer and use it in GitHub Desktop.
Save pkskelly/f9e396ff96898ea99af53da87cab1b6a to your computer and use it in GitHub Desktop.
List Users MFA Status for All Users
#Connect-MsolService
Get-MsolUser -all |
Select-Object ObjectId, IsLicensed, DisplayName, UserPrincipalName, BlockCredential, UserType, WhenCreated, LastPasswordChangeTimestamp,LicenseReconciliationNeeded,
@{N = "Type"; E = { if ( $_.UserPrincipalName.IndexOf("#EXT#") -gt 0 ) { "External" } else { "ThreeWill" } } } ,
@{N = "MFAStatus"; E = { if ( $_.StrongAuthenticationRequirements.State -ne $null) { $_.StrongAuthenticationRequirements.State } else { "Disabled" } } } ,
@{N = "ConferenceRoom"; E = { if ( ($_.UserPrincipalName).IndexOf("conference") -gt 0) { $true } else { $false } } } ,
@{N = "ThreatLevel";
E = {
if ($_.BlockCredential -like "True" ) {
"High"
}
elseif ($_.UserType -like "Member" -and $_.StrongAuthenticationRequirements.State -notlike "En") {
"High"
}
elseif ( ($_.UserPrincipalName).IndexOf("conference") -gt 0)
{
"Low"
}
else {
"Medium"
}
}
} |
Export-Csv -Path "C:\scratch\Security\MFAStatus$(get-date -f ddMMMyy-hhmmss).csv" -NoTypeInformation
@pkskelly
Copy link
Author

Added additional fields and logic to categorize accounts based on the details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment