title: Setting network share permissions on subdirectory with PowerShell
body: <p>I want to setup a network share granting READ only permissions to the root, but READ/WRITE permissions to a sub directory within it.</p>
  
  <p>I can do this manually, but I want to be able to do it using PowerShell.</p>
  
  <pre><code>\\myserver\MyShare           (READ access here for user TESTUSER)
  \\myserver\MyShare\subfolder (READ/WRITE access here for user TESTUSER)
  </code></pre>
  
  <p>Manual steps in Windows Explorer - open folder properties dialog, "Sharing" tab, "Share..." button, I can then add my user and set the permissions.  I can do this to BOTH the root of the network share and the "subfolder".</p>
  
  <p>The closest thing I have managed in PowerShell is the following, which sets up the root only:</p>
  
  <pre><code>New-SmbShare –Name MyShare –Path e:\MyShare -ReadAccess "Domain\TESTUSER"
  </code></pre>
  
  <p>However, this seems to do the equivalent of the "Advanced sharing" options that appear on the folder properties dialog, which only apply when setting up a NEW network share, and not to folders WITHIN an existing network share. When I run this script, the TESTUSER isn't added to the list of users in the simple "Share..." dialog so there must be another way of setting up the permissions.</p>
  
  <p><strong>My question:</strong> How do I setup permissions using PowerShell in the same way Windows does from the "Share..." button on the folder properties?</p>
  
  <p>I'm using Windows Server 2012&nbsp;R2.</p>