Because instead of looking at $Entry, which is a singleton, you are looking at $ShareAcces, which is a collection.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/PH0PR07MB8717D27A3DB1C5B1AA7C5D50AD31A%40PH0PR07MB8717.namprd07.prod.outlook.com.
On Mon, Aug 18, 2025 at 2:24 PM Michael B. Smith <mic...@smithcons.com> wrote:Because instead of looking at $Entry, which is a singleton, you are looking at $ShareAcces, which is a collection.<DUH><SIGH> Yes, I'm sure you're right. I'll try that in a bit.I knew it had to be something simple. But when you try and solve 3-4 things at once, things slip through the cracks.
Here. And I fixed it so it also works with admin shares.
Param
(
[String] $shareNm = 'Whitehall'
)
$Share = Get-SMBShare -Name $shareNm
$SharePath = $Share.Path
$ShareAcces = $Share | Get-SMBShareAccess
ForEach ($Entry in $ShareAcces)
{
$ShareName = $Entry.Name
$ShareAcctName = $Entry.AccountName
$ShareAccessControltype = $Entry.AccessControlType
$ShareAccessRight = $Entry.AccessRight
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2BhD0wo9a%2B87mneH52FA6SGcniVyswd%3De6oM9uJi7upSFw%40mail.gmail.com.