Private/HelperFunctions.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function ValidatePath ($Path)
{
    # Validates that the path is a valid path
    return Test-Path $Path -IsValid
}

function ValidatePathExists ($Path)
{
    # Validates that the path exists
    return Test-Path $Path
}

function ValidateInstanceName ($Name)
{
    # Checks for any characters not matching a-z, A-Z, 0-9, -, and _
    # Should return false on spaces and this list of characters:
    # !"#%&/()=?@{[]}$+\^~*<>;:
    if ($Name -match "[^\-\w]")
    {
        return $false
    }

    return $true
}