inventory of SHARED permissions on the SHARES

I would like to get an inventory of groups and users SHARED permissions on the SHARES. SEe the screenshots.
not NTFS permissions, but SHARED permissions.

Thank you so much!

Perhaps you already written a scirpt like this.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ben Personick (Previously QCubed)Lead Network EngineerCommented:
Hahahahaha.  Good one.

Share permissions are stored in the registry in a binary glob.

Maybe someone has a clue on how to parse that binary glob, but I haven't found a way, instead I usually set up the security the way I want it in NTFS, and then replace the globs with a glob I saved from a share with everyone full.

To see for yourself, the file shares are located here:


Open in new window

Under the shares there is a key called security which contains ths binary permissions glob I've just been mentioning.
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
If you are using W8 / 2012 or above, Get-SmbShare | select Name, SecurityDescriptor provides a list of DACLs.
Ben Personick (Previously QCubed)Lead Network EngineerCommented:
Worth using the above if you're on 2012... also I suppose that means you could import registry hives from non 2012 servers for lanman and get their permissions infor for the shares if you're desperate.
WMI gives you access to this without breaking a sweat, even remotely:
Function Get-SmbSharePermission([String]$ComputerName = '.') {
	$Shares = @{}
	Get-WmiObject -Class Win32_Share -ComputerName $ComputerName | ForEach-Object {$Shares[$_.Name] = $_.Path}
	Get-WmiObject -Class Win32_LogicalShareSecuritySetting -ComputerName $ComputerName | ForEach-Object {
		$Name = $_.Name
		$_.GetSecurityDescriptor().Descriptor.DACL | Select-Object -Property `
			@{n='ComputerName'; e={$ComputerName}},
			@{n='Name'; e={$Name}},
			@{n='Path'; e={$Shares[$Name]}},
			@{n='Account'; e={"$($_.Trustee.Domain)\$($_.Trustee.Name)".Trim('\')}},
			@{n='Permission'; e={
				Switch ($_.AccessMask) {
					0x001F01FF	{'Full'}
					0x001301BF	{'Change'}
					0x001200A9	{'Read'}
					default		{"0x$($_.ToString('X8'))"}
			@{n='Type'; e={If ($_.AceType) {'Deny'} Else {'Allow'}}}
Get-SmbSharePermission | Export-Csv -NoTypeInformation -Path C:\Temp\SharePermissions.csv

Open in new window

Edit: Enhancement to determining the share path.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
creative555Author Commented:
Excellent script. I tested it and got a nice report. Thanks a lot!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.