Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Powershell Remove Everyone From Sharing - Advanced Sharing Permissions

$
0
0

Okay, I'm having some issues removing the Everyone Share permissions from Advanced Sharing on a workstation via Powershell. I need to process this via 100 workstations and a few hundred servers.

I want to recreate this functionality:
net share Test=C:\test /grant:username,Read /cache:none /unlimited
But, using powershell so that I can iterate over multiple workstations and servers

I have figured out how to list the share:
(Get-WmiObject -Class "Win32_LogicalShareSecuritySetting" -ComputerName $COMPUTERNAME -Namespace root\cimv2  -filter "Name='Test'").GetSecurityDescriptor().Descriptor.DACL.Trustee

$share = Get-WmiObject Win32_Share -List -ComputerName $COMPUTERNAME
$share.create($ShareDir, $ShareName, 0).Result

I know that there is Win32_SecurityDescriptor class https://msdn.microsoft.com/en-us/library/aa394402(v=vs.85).aspx
But, I'm really confused about how to configure it.

And I don't want EVERYONE in the Share Permissions. 

I know, I know ... I've searched online over and over and over. This is somewhere that I'm falling short. Scripts that I'm finding online aren't even working.

Thanks for your help. 


Viewing all articles
Browse latest Browse all 6937

Trending Articles