So, I have a UNC path something like this:
\\server\folder
I want to get only the path to the server, for example, \\server . Split-Path "\\server\folder" -Parent returns "" . Everything that I try, as for the root, does not produce results. For example, Get-Item "\\server" does not work either.
How to safely get the path to \\server from \\server\\folder in PowerShell?
source share