Forum Discussion
Deleted
Nov 20, 2017Admin Roles Report
I want to see which users are assigned admin role privileges in O365 for all admin role attributes.... Who can help me to get this report?
VasilMichev
MVP
You are not being very specific here, but here's one of the snippets I use for reporting on Admin role assignments:
$roles = Get-MsolRole $arrPermissions = @();$i=0; foreach ($role in $roles) { $members = Get-MsolRoleMember -RoleObjectId $role.ObjectId.Guid if (!$members) { continue } foreach ($member in $members) { $objPermissions = New-Object PSObject $i++;Add-Member -InputObject $objPermissions -MemberType NoteProperty -Name "Number" -Value $i Add-Member -InputObject $objPermissions -MemberType NoteProperty -Name "Role" -Value $role.Name Add-Member -InputObject $objPermissions -MemberType NoteProperty -Name "UPN" -Value $member.EmailAddress Add-Member -InputObject $objPermissions -MemberType NoteProperty -Name "Display Name" -Value $member.DisplayName Add-Member -InputObject $objPermissions -MemberType NoteProperty -Name "Type" -Value $member.RoleMemberType Add-Member -InputObject $objPermissions -MemberType NoteProperty -Name "isLicensed" -Value $member.isLicensed if ($member.RoleMemberType -ne "ServicePrincipal") { Add-Member -InputObject $objPermissions -MemberType NoteProperty -Name "isSynced" -Value (&{If((Get-MsolUser -UserPrincipalName $member.EmailAddress).LastDirsyncTime) {"True"} Else {"False"}}) Add-Member -InputObject $objPermissions -MemberType NoteProperty -Name "PasswordNeverExpires" -Value (&{If((Get-MsolUser -UserPrincipalName $member.EmailAddress).PasswordNeverExpires) {"True"} Else {"False"}}) Add-Member -InputObject $objPermissions -MemberType NoteProperty -Name "MFA Enabled" -Value (&{If((Get-MsolUser -UserPrincipalName $member.EmailAddress).StrongAuthenticationRequirements.State) {"True"} Else {"False"}}) } $arrPermissions += $objPermissions } } $arrPermissions #| Export-Csv -Path "$((Get-Date).ToString('yyyy-MM-dd_HH-mm-ss'))_AdminPermissions.csv" -NoTypeInformation
Deleted
Nov 22, 2017Vasil,
Are you happy to share this script?
Are you happy to share this script?
- VasilMichevNov 22, 2017MVP
I pasted it in my reply above?