Create a Share and Set Permissions

  Add a new share using PowerShell and WMI.  Also initially sets the share security.  The default is to set the share to "Read" and to the current user. This code was migrated from PowerShell V1 version as an Advanced Function/Script.  It supports -verbose and -debug as well as

 
 
 
 
 
3.1 Star
(10)
Add to favorites
Storage
9/5/2015
E-mail Twitter del.icio.us Digg Facebook
  • Fix for PS v4
    1 Posts | Last post February 20, 2016
    • Not sure if this is a version failure, but the share permissions were not being set for me. No errors. Just no share perms set at all. Add this to resolve:
      replace this: $ace.AccessMask = $rights 
      with this:
      switch ($Rights)
              {
                 “Read” { $ACE.AccessMask = 1179817 }
                 “Change” { $ACE.AccessMask = 1245631 }
                 “Full” { $ACE.AccessMask = 2032127 }
              }
  • Ho to Use it
    1 Posts | Last post September 04, 2015
    • IT Could be useful to have some examples on how to use it. 
      
      Thanks.
  • Seems broken on W2K8R2
    2 Posts | Last post January 07, 2014
    • hi,
      
      The version of this script hosted here @20140107 does not work as intended on W2K8R2, specifically:
      
      "User limit" has "Allow this number of users" radio button checked, and number set to 0.
      
      Modifying the script line from:
      [string]$maxallowed = $null 
      
      To:
      $maxallowed = $null 
      
      Resolved this issue in my case
    • jrv
      I just retested on WS2008R2, Windows 7 and Windows 8.1.  It works on all of those versions.  The null or string value is cast to a int by the Create method.  It hs not changed since XP or earlier.
      
      Perhaps you missed an error In your usage that fooled you into thinking that that was the fix.
      
      If you can show me an exact command that repeatedly fails I will look further into this.
      
      Thanks for the info.  Let me know if you can repeat the problem.
  • Single Bracket
    2 Posts | Last post December 17, 2013
    • There is a single orphan bracket in the "params". Should it be removed?
      Thanks
    • jrv
      Yes -Thank you
      
      This script has been here for years.  I see somehow it was edited two months ago. I wonder how.