by AdminAlley at 2013-02-12 17:05:19
I hope this is the right place for this question but I was going through the PSv3 Month of Lunches book and got to the end of chapter 12 to do the lab. I came up with a different solution than Don had posted and I’m scratching my head on why it didn’t turn out correctly. Hoping someone can see the error. Basically the lab (if you don’t have the book available) was asking to create a brand new file share called ‘LABS’, have ‘Everyone’ set to read/write, ‘Administrators’ to full control, & set the caching mode for documents. There is more to it but my issue is with this bit. Here is what I created:by DonJ at 2013-02-13 07:36:39
New-SMBShare -Name LABS -Path (New-Item -Path c:\LABS -ItemType Directory) -CachingMode Documents -ChangeAccess Everyone -FullAccess Administrators
Directory was created along with it being a share. Although the groups were never added and I wasn’t presented with an error. Going through the help of ‘New-SMBShare’, the portions for ‘-ChangeAccess’ and ‘-FullAccess’ only mention users. But Don’s answer showed the same entry in front of those commands. So I’m scratching my head and can’t figure out a solution. The examples don’t show much either. I tried adding the PC name with a slash before the group name and quotation marks around the group names, still nothing. Any ideas? I get the same result with Don’s code.
Don’s Portion of the answer:
New-smbshare -name ‘LABS’ -Path ‘C:\Labs’ -Description ‘PowerShell Labs’ -ChangeAccess ‘Everyone’ -FullAccess ‘Administrators’ -CachingMode Documents
Side note, module for SMBShare was loaded & this is on Server 2012.
Well, there’s no “correct” solution. There’s a lot of ways to do things - we just present a sample solution, not the only possible one. That said, I think Jeff actually did this lab. Let me see if he’s got an idea - I don’t have the manuscript or shell handy.by JeffH at 2013-02-13 08:34:27
I tried this again on Windows 8 and I get the expected result. Remember the access is NOT the NTFS settings but the share permissions. When you run the share through Get-SMBShareAccess you should see this:by AdminAlley at 2013-02-13 14:59:31
PS C:> get-smbshare labs | get-smbshareaccess
Name ScopeName AccountName AccessControlType AccessRight
---- --------- ----------- ----------------- -----------
LABS * BUILTIN\Administ… Allow Full
LABS * Everyone Allow Change
SMH, You’re absolutely right. I was looking at the ‘Network and Folder Sharing’ section and not the ‘Advanced Sharing…’. Thank you both for the clarification.