question

asifA-5465 avatar image
0 Votes"
asifA-5465 asked MotoX80 commented

Shared folder permission change

I have
share name - > AAaroshi$
Path - > \\SDLFS-V101\AAaroshi$
I want to change share permission of the user id AAaroshi to read only

I am using Server 2008 R2 and have PS Version 5 and 7

I try to do Install-Module -Name Find-SMBShare but I get error no match. How do I change the permission. Please help using PS V2 or PS V7

windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered

Windows Server 2008 R2 reached "end of life" in January of 2020! It includes Powershell version 3.0 shipped with Windows Server 2008 R2. But it's still pretty old!

Windows PowerShell V2? Yikes!!! I'd use "NET SHARE" to do the job!

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

asifA-5465 avatar image
0 Votes"
asifA-5465 answered RichMatheisen-8856 commented

i try to use like this
NET SHARE AAaroshi$=u:\userdata1\AAaroshi /GRANT:AAaroshi,Read /UNLIMITED /CACHE:None
I get message "The name has already been shared."

I want to change permission from CHANGE to READ. Please help (I want to modify the existing share permission)

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Run it twice. Once to remove the user and a second time to add the user with the permission you want.

0 Votes 0 ·
asifA-5465 avatar image asifA-5465 RichMatheisen-8856 ·

I make sure ran 2 times, not 3 times but still the same

0 Votes 0 ·

If you have PowerShell 5 why not use Get-SMBShare and Revoke-SMBShareAccess?

Is it safe to say that the last line in your original post (where you said you had PowerShell V2) was in error?

0 Votes 0 ·
asifA-5465 avatar image
0 Votes"
asifA-5465 answered MotoX80 commented

When I use Get-SMBShare I get error "The term 'Get-SMBShare' is not recognized as the name of a cmdlet, function" I google and do this

https://stackoverflow.com/questions/52974537/powershell-v6-smbshare-commands-returning-error-is-not-recognized-as-the-nam

I type GetSMBShare and get the same error. I have PS V5 and V7

· 9
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I get message "The name has already been shared."

Just delete the share and re-add it.

 NET SHARE AAaroshi$ /delete
 NET SHARE AAaroshi$=u:\userdata1\AAaroshi /GRANT:AAaroshi,Read /UNLIMITED /CACHE:None



0 Votes 0 ·

I don't want to delete because other groups have permissions for that share I need to re-add them

0 Votes 0 ·

Does your PSModulePath include C:\Windows\system32\WindowsPowerShell\v1.0\Modules and does the SMBShare subfolder exist? Note, I am running 5.1 on Win11.


 ($env:PSModulePath).split(";")
 Get-Childitem C:\Windows\system32\WindowsPowerShell\v1.0\Modules\SmbShare






0 Votes 0 ·
Show more comments

Get-SMBShare isn't available in PowerShell 7 (or 6). There are other areas (like WMI) that are also lacking because the other operating systems don't have anything comparable.

Use PowerShell 5.

PowerShell 6 and 7 are "cross-platform" versions of PowerShell, meant to be used (within limits) to write portable code that can run on Windows, *nix, etc. Linux has its own implementation of SMB, it's called "Samba".

0 Votes 0 ·