Last active
May 17, 2019 19:20
-
-
Save pkskelly/f9e396ff96898ea99af53da87cab1b6a to your computer and use it in GitHub Desktop.
List Users MFA Status for All Users
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added additional fields and logic to categorize accounts based on the details.