internal/configurationvalidation/guidarray.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
25
26
27
28
29
30
Register-PSFConfigValidation -Name "guidarray" -ScriptBlock {
    param (
        $Value
    )
    
    $Result = New-Object PSObject -Property @{
        Success = $True
        Value   = $null
        Message = ""
    }
    
    try
    {
        $data = @()
        foreach ($item in $Value)
        {
            $data += [guid]$item
        }
    }
    catch
    {
        $Result.Message = "Not a guid array: $Value"
        $Result.Success = $False
        return $Result
    }
    
    $Result.Value = $data
    
    return $Result
}