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)"
}
The error message is literally correct. \\storageserver
is not a path. It is two backslashes followed by a computer name.
Append a share name to it, and it becomes a path; e.g. \\storageserver\sharename
.
You can list shares by calling:
net view \\<computername>
source: PowerShell Get List Of Folders Shared