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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top