I\'m working on a script to get my ACLs for all of the shares in my network. I have three separate UNC paths that I am running this on. Two of the three are working perfec
As I mentioned in the comments \\computername
is only a partial UNC path (check the UNC grammar in the [MS-DTYP] Windows Data Type specification).
Explorer "knows" this, and so it does some black magic in the background to allow you to browse the shares on the remote computer.
You can emulate this, by querying the Win32_Share
WMI instances on the remote machine:
foreach($Share in Get-WmiObject Win32_Share |?{$_.Name -not 'IPC$'}){
Get-ChildItem "\\$($Share.__SERVER)\$($Share.Name)"
}