none
PowerShell script to edit the permissions on the Shared Folder

    Pertanyaan

  • Hi All,

    I am looking for a PowerShell script to edit the permissions on the Shared Folder. for example if I have a folder shared to a set of individuals then I will like to add or remove the people after reviewing the list. Also I would like to share the Folder through the PowerShell Script.

    Please help me with this.

    Thanks, V


    Vaman Salkar

    • Dipindahkan oleh Bill_Stewart Minggu, 29 Desember 2013 23.32 Abandoned
    Selasa, 27 Agustus 2013 00.50

Semua Balasan

  • Usually with shares we just allow full access and set individual permissions on the underlying folders. Share permissions are not very granular and are harder to manage.


    ¯\_(ツ)_/¯


    • Diedit oleh jrv Selasa, 27 Agustus 2013 01.01
    Selasa, 27 Agustus 2013 01.01
  • Hello,

    This should work for you and the only note is this adds and removes the Everyone group because it gets added by default using the Grant Cmdlet fro some reason. 

    $myUserAccess=Get-Content C:\temp\list.txt
    
    New-SmbShare -Name "MyNewShares" -Path "C:\Temp"
    
    Foreach($User in $myUserAccess){
    
        Grant-SmbShareAccess -Name "MyNewShares" -AccountName $User -AccessRight Full -Confirm -Force
        
        }
    
    Revoke-SmbShareAccess -Name "MyNewShares" -AccountName "Everyone" -Force

    • Disarankan sebagai Jawaban oleh ComputerScott Rabu, 21 November 2018 19.28
    Rabu, 21 November 2018 18.56
  • Hello,

    This should work for you and the only note is this adds and removes the Everyone group because it gets added by default using the Grant Cmdlet fro some reason. 

    $myUserAccess=Get-Content C:\temp\list.txt
    
    New-SmbShare -Name "MyNewShares" -Path "C:\Temp"
    
    Foreach($User in $myUserAccess){
    
        Grant-SmbShareAccess -Name "MyNewShares" -AccountName $User -AccessRight Full -Confirm -Force
        
        }
    
    Revoke-SmbShareAccess -Name "MyNewShares" -AccountName "Everyone" -Force

    The topic is clearly labeled as "DO NOT POST HERE" look closely at the top of the page.


    \_(ツ)_/

    Rabu, 21 November 2018 19.51