So, we got the role entries for the management role, let’s now find out what management roles have a specific role entry. Basically, this is the revers of RBAC Helper #1.
Update 03/22/2012: I’ve updated this script due to changes in the way the Role Entries are presented.
function Find-RBACHelperManagementRoleWithRoleEntry
{
param(
[Parameter(Mandatory=$true)]
[string]$RoleEntry
)
begin { }
Process{
$objManagementRoles = get-managementRole
foreach($mgtRole in $objManagementRoles)
{
$entries = $mgtRole.RoleEntries
foreach($entry in $entries)
{
$cmd = $entry.split(' ')[1]
if ($cmd -eq "$RoleEntry")
{
write-host -fore yellow $mgtRole.name
}
}
}
}
end { }
}
Cool blog,looking to communicate