Today is: 29 July, 2010

Adding rights to a file or folder with PowerShell

Pretty straight forward example and reference for adding rights to a folder or file with PowerShell.

Example

$AccessControl = get-acl "D:\My Documents"

$AccessRule = New-Object Security.AccessControl.FileSystemAccessRule("Users", "FullControl", "ContainerInherit, ObjectInherit", "None", "Allow")

$AccessControl.AddAccessRule($AccessRule) set-acl -aclobject

$AccessControl -path "D:\My Documents"

Reference

Construction of FileSystemAccessRule object

FileSystemAccessRule(identity, fileSystemRights, inheritanceFlags, propagationFlags, type)

Inheritance and Propagation Translations

Subfolders and Files only
InheritanceFlags.ContainerInherit, InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly
This Folder, Subfolders and Files
InheritanceFlags.ContainerInherit, InheritanceFlags.ObjectInherit, PropagationFlags.None
This Folder, Subfolders and Files
InheritanceFlags.ContainerInherit, InheritanceFlags.ObjectInherit, PropagationFlags.NoPropagateInherit
This folder and subfolders
InheritanceFlags.ContainerInherit, PropagationFlags.None
Subfolders only
InheritanceFlags.ContainerInherit, PropagationFlags.InheritOnly
This folder and files
InheritanceFlags.ObjectInherit, PropagationFlags.None
This folder and files

InheritanceFlags.ObjectInherit, PropagationFlags.NoPropagateInherit

Nike Shox nz

After reading your blog, I feel very exciting! Thanks for sharing so wonderful article with us. Every one like climbing,running or any other sprots? So a comfortable and high-quality shoes is very essential.Welcome to our website to see all kinds of shoes by Nike Shox nz or Nike Shox Deliver .Thanks!