Skip to content

Instantly share code, notes, and snippets.

@AdamNaj
Last active February 6, 2017 13:53
Show Gist options
  • Save AdamNaj/0add451a264d8a63d3eb0bbafb5bf501 to your computer and use it in GitHub Desktop.
Save AdamNaj/0add451a264d8a63d3eb0bbafb5bf501 to your computer and use it in GitHub Desktop.
List Roles for User
function Get-UserRoles{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true, Position=0)]
[string]$Identity
)
$user = Get-User $Identity
return Get-Role -Filter * | Where-Object { $_.IsMember($user,$true,$true) }
}
Write-Host "Roles for ServicesAPI" -ForegroundColor Green
Get-UserRoles "sitecore\ServicesAPI"
Write-Host "Roles for Admin" -ForegroundColor Green
Get-UserRoles "sitecore\admin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment