# encoding: ascii
# api: powershell
# title: Get-UNCPath
# description: Simple function that returns the UNC path (administrative share) of a local path.
# version: 0.1
# type: function
# author: dragonmc77
# license: CC0
# function: Get-UNCPath
# x-poshcode-id: 5655
# x-archived: 2015-11-26T03:22:38
# x-published: 2015-12-30T18:53:00
#
#
function Get-UNCPath {param( [string]$HostName,
[string]$LocalPath)
$NewPath = $LocalPath -replace(":","$")
#delete the trailing \, if found
if ($NewPath.EndsWith("\")) {
$NewPath = [Text.RegularExpressions.Regex]::Replace($NewPath, "\\$", "")
}
"\\$HostName\$NewPath"
}