Skip to content

Instantly share code, notes, and snippets.

@dpo007
Created April 13, 2020 19:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpo007/6a356b138610f38dfaf2c4d9362e327e to your computer and use it in GitHub Desktop.
Save dpo007/6a356b138610f38dfaf2c4d9362e327e to your computer and use it in GitHub Desktop.
PowerShell Function :: Get HostName From UNC Path
function GetHostNameFromUNC {
param (
[Parameter(Mandatory=$true)]
[string]$UNCPath
)
$UNCPath -match '\\\\(.*?)\\' | Out-Null
if ($Matches.Count -ge 2) {
return $Matches[1]
} else {
return $null
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment