_sandbox/userssandbox.ps1
Get-Mailbox -RecipientTypeDetails UserMailbox | Where-Object { $_.DisplayName -ne "Discovery Search Mailbox" } |Select-Object DisplayName, UserPrincipalName | ForEach-Object{ Get-MsolUser -UserPrincipalName $_.UserPrincipalName | Select-Object UserPrincipalName, DisplayName, @{Name = "MethodType"; Expression = { ((Get-MsolUser -UserPrincipalName $_.UserPrincipalName).StrongAuthenticationMethods | Where-Object { $_.IsDefault -eq $true }).MethodType}}, @{Name = "Status"; Expression = { if (((Get-MsolUser -UserPrincipalName $_.UserPrincipalName).StrongAuthenticationRequirements[0]).State -ne $null) { ((Get-MsolUser -UserPrincipalName $_.UserPrincipalName).StrongAuthenticationRequirements[0]).State} else {"Disabled"}} } } | Export-CSV -Path C:\temp\HRSD\StrongAuthenticationMethods.csv -NoTypeInformation $temp = Get-MsolUser -All | Select-Object UserPrincipalName, DisplayName, @{Name = "MethodType"; Expression = { ((Get-MsolUser -UserPrincipalName $_.UserPrincipalName).StrongAuthenticationMethods | Where-Object { $_.IsDefault -eq $true }).MethodType}}, @{Name = "Status"; Expression = { if (((Get-MsolUser -UserPrincipalName $_.UserPrincipalName).StrongAuthenticationRequirements[0]).State -ne $null) { ((Get-MsolUser -UserPrincipalName $_.UserPrincipalName).StrongAuthenticationRequirements[0]).State} else {"Disabled"}} } Get-MsolUser -All | Select-Object UserPrincipalName, DisplayName, @{Name = "MethodType"; Expression = { if (((Get-MsolUser -UserPrincipalName $_.UserPrincipalName).StrongAuthenticationMethods | Where-Object { $_.IsDefault -eq $true }).MethodType -ne $null) {((Get-MsolUser -UserPrincipalName $_.UserPrincipalName).StrongAuthenticationMethods | Where-Object { $_.IsDefault -eq $true }).MethodType } else {"None"} }, @{Name = "Status"; Expression = { if (((Get-MsolUser -UserPrincipalName $_.UserPrincipalName).StrongAuthenticationRequirements[0]).State -ne $null) { ((Get-MsolUser -UserPrincipalName $_.UserPrincipalName).StrongAuthenticationRequirements[0]).State} else {"Disabled"}} } (Get-MsolUser -All | Where-Object { $_.StrongAuthenticationMethods -ne $null } | Select-Object UserPrincipalName, DisplayName ).Count $temp = Get-MsolUser -All | Where-Object { $_.StrongAuthenticationMethods -ne $null } | Select-Object UserPrincipalName, DisplayName, @{Name = "MethodType"; Expression = { ((Get-MsolUser -UserPrincipalName $_.UserPrincipalName).StrongAuthenticationMethods | Where-Object { $_.IsDefault -eq $true }).MethodType } } Get-MsolUser -All | Where-Object { $_.StrongAuthenticationMethods -ne $null } | Select-Object UserPrincipalName, DisplayName, Get-MsolUser -All | Where-Object { $_.StrongAuthenticationMethods -ne $null } | Select-Object UserPrincipalName, DisplayName, @{Name = "MethodType"; Expression = { ((Get-MsolUser -UserPrincipalName $_.UserPrincipalName).StrongAuthenticationMethods | Where-Object { $_.IsDefault -eq $true }).MethodType } }, @{Name = "Status"; Expression = { $temp = ((Get-MsolUser -UserPrincipalName $_.UserPrincipalName).StrongAuthenticationRequirements[0]).State }; if ($temp) { $temp } else { "None" } } } | Export-CSV -Path C:\temp\HRSD\StrongAuthenticationMethods.csv -NoTypeInformation Get-AzureADGroup |Select-Object DisplayName, @{Name = "SID"; Expression = { Convert-ObjectIdToSid -ObjectId $_.ObjectId }} Get-AzureADDirectoryRole |Select-Object DisplayName, @{Name = "SID"; Expression = { Convert-ObjectIdToSid -ObjectId $_.ObjectId }} |