Im not entirely sure where to put this, so hardware seemed the best option. If the admins feel it needs to be moved, please do so.
K so problem at hand.
I need to remove specific explicitly assigned permissions on an OU.
Now Quest has some nifty PowerShell commands, 1 of them being Get-QADPermissions.
So my initial command is:
Get-QADPermission -Identity 'ou=test1,dc=training,dc=com' -Account 'User1'
Now the output is as follows:
Ctrl Account Rights Source AppliesTo
---- ------- ------ ------ ---------
TRAINING\User1 Special Not inherited This object only
If i add | FL ill get the full breakdown of "Rights":
Rights : CreateChild, DeleteChild, ListChildren, ReadProperty, GenericWrite
Now my issue is i only want to remove the GenericWrite but for the life of me i cant seem to work out a way.
My initial try was:
Get-QADPermission -Identity 'ou=test1,dc=training,dc=com' -Account 'User1' | Remove-QADPermission
But that remove all explicitly assigned permissions for that User1 account
I was goin as far as using ADSISearcher, but again not sure how to select a specific ACE.
Import-Module activedirectory
$OU = [adsi]([adsisearcher]'(&(objectclass=organizationalunit)(name=Test1))').FindOne().Path
$AccessRule = $OU.psbase.ObjectSecurity.access
$ACEToBeRemoved = $OU.psbase.ObjectSecurity.RemoveAccess[0]
$AccessRule |
ForEach-Object{
if($AccessRule.IdentityReference -eq 'TRAINING\User1)
{$OU.psbase.ObjectSecurity.RemoveAccessRule($ACEToBeRemoved)}
$OU.psbase.commitchanges()
If there are any gurus out there I could really use some help...
K so problem at hand.
I need to remove specific explicitly assigned permissions on an OU.
Now Quest has some nifty PowerShell commands, 1 of them being Get-QADPermissions.
So my initial command is:
Get-QADPermission -Identity 'ou=test1,dc=training,dc=com' -Account 'User1'
Now the output is as follows:
Ctrl Account Rights Source AppliesTo
---- ------- ------ ------ ---------
TRAINING\User1 Special Not inherited This object only
If i add | FL ill get the full breakdown of "Rights":
Rights : CreateChild, DeleteChild, ListChildren, ReadProperty, GenericWrite
Now my issue is i only want to remove the GenericWrite but for the life of me i cant seem to work out a way.
My initial try was:
Get-QADPermission -Identity 'ou=test1,dc=training,dc=com' -Account 'User1' | Remove-QADPermission
But that remove all explicitly assigned permissions for that User1 account
I was goin as far as using ADSISearcher, but again not sure how to select a specific ACE.
Import-Module activedirectory
$OU = [adsi]([adsisearcher]'(&(objectclass=organizationalunit)(name=Test1))').FindOne().Path
$AccessRule = $OU.psbase.ObjectSecurity.access
$ACEToBeRemoved = $OU.psbase.ObjectSecurity.RemoveAccess[0]
$AccessRule |
ForEach-Object{
if($AccessRule.IdentityReference -eq 'TRAINING\User1)
{$OU.psbase.ObjectSecurity.RemoveAccessRule($ACEToBeRemoved)}
$OU.psbase.commitchanges()
If there are any gurus out there I could really use some help...