0

I found a list of Windows shares using this cmdlet:

gwmi -Class win32_share -ComputerName blah

However, when I use the below cmdlet, it does not show the security setting for ALL shares:

gwmi -Class Win32_LogicalShareSecuritySetting -ComputerName blah

I can see the share w/ the missing security via the Server Management console. Can anyone help? thx!

NOTE: There's a huge discrepancy between the number of record returned from win32_share and win32_logicalsharesecuritysetting.

Johnny Wu
  • 1,297
  • 15
  • 31
  • Which version of PowerShell are you using? If it's a recent one, you might want to look at the _SmbShare_ cmdlets. For example: `Get-SmbShare | Get-SmbShareAccess` – boxdog Jul 09 '18 at 22:28
  • I am using 4.0...and yes, Get-smbshare and access are available...thx! btw, you might want to post this as a solution, so I can give you credit for it. – Johnny Wu Jul 13 '18 at 13:22
  • Glad it helped. I added it as an answer. – boxdog Jul 13 '18 at 13:43

1 Answers1

1

An alternative to using WMI classes directly is to use the SmbShare cmdlets. For example, the following will list all of the share permissions on the local machine (can also work remotely):

Get-SmbShare | Get-SmbShareAccess
boxdog
  • 7,894
  • 2
  • 18
  • 27