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