title: Powershell: Combine ContainerInherit and ObjectInherit in FileSystemAccessRule?
body: <p>I'm writing a script that should set filesystem access rights for a folder and all of it's contents.</p>
  
  <p>To affect all content, both subfolders and files, one should combine ContainerInherit and ObjectInherit according to the .NET documentation. But I can't get that to work and I'm not sure about the syntax.</p>
  
  <p>Sample code:</p>
  
  <pre><code>$ar = new-object System.Security.AccessControl.FileSystemAccessRule(New-Object System.Security.Principal.NTAccount($user),FullControl,ContainerInherit,InheritOnly,Allow)
  </code></pre>
  
  <p>That'll work and so would using <code>ObjectInherit</code> only, but how can I combine them? Using quotation marks and a comma, like this <code>"ContainerInherit,ObjectInherit"</code> won't work, since it's appearantly not allowed to mix string and non-string argument.</p>
  
  <p>I've also tried using the <code>-and</code> operator, but that just gives me an error. Assigning the enums to a variable (<code>$inherit = ContainerInherit,ObjectInherit</code>) won't work either.</p>
  
  <p>So, any tips on how to do this?</p>