Hi,
See if this works for you
$servers = "server1","server2","server3"
Invoke-Command -ComputerName $servers -ScriptBlock{Get-SmbShare | Where-Object {$_.Name -notmatch ".+\$"} | Get-SmbShareAccess | Where-Object {$_.AccountName -eq "Everyone"} | ForEach-Object {
Revoke-SmbShareAccess -name $_.name -AccountName $_.AccountName -Force}
}
Best Regards,
Ian
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
I want to remove the Everyone permissions for the net share folder except ('Remote Admin' ,"Default share' , 'Remote IPC' , 'Printer Drivers'" ) and in place of Everyone I need to add the Authenticated Users group for all the net shares.
It would be great if someone can please help me achieve this...
Regards,
Chandrakanth.