Guest Kim Br Posted December 2, 2019 Posted December 2, 2019 Hello, What im trying to do is delegating control (admin rights) to specific users in a security group so that they are administrators for a OU. However i get the error message: You cannot call a method on a null-valued expression. At line:0 char:1 + $OU.psbase.ObjectSecurity.AddAccessRule($ACE) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: ( [], RuntimeException +FUllyQualifiedErrorId : InvokeMethodNull Below is the complete script: $OU = [ADSI]("LDAP://OU=Teknik,OU=Melldala,DC=lab,DC=nu") $Group = Get-ADGroup ("Teknik") $Sid = [system.Security.Principal.SecurityIdentifier] $Group.SID $identity = [system.Security.Principal.IdentityReference] $SID $adRights = [system.DirectoryServices.ActiveDirectoryRights] ("GenericAll") $type = [system.Security.AccessControl.AccessControlType] ("Allow") $Inheritencetype = [system.DirectoryServices.ActiveDirectorySecurityInheritance] "All" $ACE = New-Object System.DirectoryServices.ActiveDirectoryAccessRule $identity,$adrights,$Inheritencetype $OU.psbase.ObjectSecurity.AddAccessRule($ACE) $OU.psbase.commitchanges() Any Ideas? Continue reading... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.