Permit AD rights builtin groups


hello,

i've powershell scripts gives ad group rights ou. works fine exceprt builin groups. (like "windows authorization access group" group)

i'm using following script (this part of script, variables defined earlier in script):

when change "windows authorization access group" workes. how can work group?

### klantgroep read rechten geven op de ou van de klant
    $sec = $objdomaingroup.psbase.objectsecurity

    $act = [system.security.accesscontrol.accesscontroltype]::allow
    $objinherit = [system.directoryservices.activedirectorysecurityinheritance]"all"

    $adrights1 = [system.directoryservices.activedirectoryrights]::readcontrol
    $adrights2 = [system.directoryservices.activedirectoryrights]::listobject
    $adrights3 = [system.directoryservices.activedirectoryrights]::listchildren
    $adrights4 = [system.directoryservices.activedirectoryrights]::readproperty
 
### zet rechten bedrijfsgroep
    $who1 = new-object -typename system.security.principal.ntaccount -argumentlist "", "windows authorization access group"

    $newrule1 = new-object -typename system.directoryservices.activedirectoryaccessrule -argumentlist $who1, $adrights1, $act, $objinherit
    $newrule2 = new-object -typename system.directoryservices.activedirectoryaccessrule -argumentlist $who1, $adrights2, $act, $objinherit
    $newrule3 = new-object -typename system.directoryservices.activedirectoryaccessrule -argumentlist $who1, $adrights3, $act, $objinherit
    $newrule4 = new-object -typename system.directoryservices.activedirectoryaccessrule -argumentlist $who1, $adrights4, $act, $objinherit
   
    $sec.addaccessrule($newrule1)
    $sec.addaccessrule($newrule2)
    $sec.addaccessrule($newrule3)
    $sec.addaccessrule($newrule4)
   
    $objdomaingroup.psbase.commitchanges()

remco


what if use sid? http://support.microsoft.com/kb/243330

replace

$who1 = new-object -typename system.security.principal.ntaccount -argumentlist "", "windows authorization access group"

with

$who1 = new-object system.security.principal.securityidentifier("s-1-5-32-560")



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

directory stack

PowerShell List

Dns access list