This script, is discussed in detail on the Hey Scripting Guy blog. It is discussed on the Saturday November 26, 2011 article, "Use PowerShell to find out who has permissions to a share." There are three variables that will need to be modified: $cred, the user credentials, $share, the name of the share, and finally $cn, the name of the remote computer. The script uses an "Associators Of" WMI query to return information from shares and user sids.

# ----------------------------------------------------------------------------- 
# Script: Get-ShareUsers.ps1 
# Author: ed wilson, msft 
# Date: 11/21/2011 15:14:55 
# Keywords: Storage, Shared Folders and Mapped Drives, Security 
# comments: 
# WES-11-26-11 
# ----------------------------------------------------------------------------- 
$cred = Get-Credential -Credential iammred\administrator 
$share = "data" 
$cn = "hyperv1" 
$query = "Associators of {win32_LogicalShareSecuritySetting='$share'}  
 Where resultclass = win32_sid" 
 Get-WmiObject -query $query -cn $cn -cred $cred |  
 Select-Object -Property @{LABEL="User";EXPRESSION= 
  {"{0}\{1}" -$_.ReferencedDomainName, $_.AccountName}}, SID