SetOwner The security identifier is not allowed to be the owner of this object

  • Thread starter Thread starter Matt
  • Start date Start date
M

Matt

Im trying to set the ownership of a folder to a group called SecGroup. If I try this code I get an error.

"The security identifier is not allowed to be the owner of this object"

I can set this group to the owner via the gui fine.



path = "c:\test\"
Dim dinfo As New DirectoryInfo("c:\test\")
'Dim dir As New DirectorySecurity("c:\test\", AccessControlSections.Owner)

Dim dir As DirectorySecurity = dinfo.GetAccessControl()

dir.SetOwner(new NTAccount("DOMAIN\SecGroup"))
dinfo.SetAccessControl(dir)


Please Help
Thanks
Matt
 
Back
Top