functions/private/Confirm-IsValidPath.ps1
function Confirm-IsValidPath { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [string] $name, [Parameter(Mandatory = $true)] [string] $type, [string] $value ) $result = @{check = "IsValidPath"; name = $name; type = $type; value = $value} if (!(Test-Path $value)) { $result.Add("errorFlag", 1) $result.Add("level", "Fatal") $result.Add("message", """$value"" is not a valid path. Please specify a valid path for the ""$name"" configuration") } else { $result.Add("errorFlag", 0) } return (New-CheckResult @result) } |