JSI Tip 3528. How do I set ownership and manage permissions from the command line or in a batch?

In tip 3494, we used the GUI in Windows 2000 to assign ownership of folder. Our choice of owners was very limited.

In Windows NT 4.0 you can grant the permission to take ownership, but you can't directly set ownership.

Using the SubInAcl update, you can set ownership on a folder using the following syntax:

subinacl /subdirectories <FolderPath> /setowner=<DomainName\UserName>

To set ownership for all the <FolderPath> objects:

subinacl /subdirectories <FolderPath>\*.* /setowner=<DomainName\UserName>

To see permissions on the folder and its' objects, use the CACLS command:

cacls <FolderPath> /t /e /g <DomainName\UserName>:<Perm>

where <Perm> can be one of the following:

R Read
W Write
C Change (write)
F Full control




Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish