Testing Permissions
Testing Permissions
The Test-EmdbPermission cmdlet can be used for either testing, if a specific Permission exists as well as for testing, if a User or Group has a specific right in a given context. The result is always true, it the test succeeds or false, if it fails.
Examples:
Hint: The execution of these examples requires a connected PowerShell drive. |
The following example tests, if the user-defined Permission "Custom.Reboot" exists. User-defined Permission always have a Custom. prefix:
Test-EmdbPermission "Custom.Reboot" |
Using the code-snippet below, you can test, if the User "Albert Tross" has the user-defined Permission "Custom.Reboot" in the context of the Organizational-Unit "Chicago":
$MyPermission = Get-EmdbPermission "Custom.Reboot" $MyUser = Get-EmdbUser "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago\Production\Users\Albert Tross" $MyOU = Get-EmdbOrganizationalUnit "emdb:\rootDSE\Managed Users & Computers\solys.local\Chicago" Test-EmdbPermission -Permission $MyPermission -Grantee $MyUser -OnObject $MyOU |
Note: Note that Permission-objects are not part of the context rootDSE and therefore they can be referenced without a full qualified path resp. an absolute path. |