Private/Get-ValidPath.ps1

Function Get-ValidPath {
    <#
    .SYNOPSIS
        Test a file system path and return correct path string.

    .NOTES
        Author: Aaron Parker
        Twitter: @stealthpuppy

    .PARAMETER Path
        A directory path that the function will validate and return.
    #>

    [CmdletBinding()]
    [OutputType([String])]
    Param (
        [Parameter(Mandatory = $True, Position = 0, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True)]
        [ValidateNotNullOrEmpty()]
        [Alias("PSPath")]
        [string] $Path
    )
    $output = ((Get-Item $Path).FullName).TrimEnd("\")
    Write-Output $output
}