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.