diff --git a/powershell/get-metadata.ps1 b/powershell/get-metadata.ps1 index 115c961..d1be7c8 100644 --- a/powershell/get-metadata.ps1 +++ b/powershell/get-metadata.ps1 @@ -120,7 +120,9 @@ foreach ($param in $paramBlock.Parameters) { } elseif ($attr.TypeName.Name -eq 'ValidateSet') { $val.values = $attr.PositionalArguments.Value } elseif ($attr.TypeName.Name -eq 'ValidateScript') { - $val.script = $attr.PositionalArguments.ScriptBlock.Extent.Text + $val.value = $attr.PositionalArguments.ScriptBlock.Extent.Text + } elseif ($attr.TypeName.Name -eq 'ValidatePattern') { + $val.value = $attr.PositionalArguments.Value } $validations += [pscustomobject]$val diff --git a/powershell/test-script.ps1 b/powershell/test-script.ps1 index ebe862b..6a117fc 100644 --- a/powershell/test-script.ps1 +++ b/powershell/test-script.ps1 @@ -21,6 +21,7 @@ # Accepts pipeline input by value [Parameter(ValueFromPipeline = $true, ParameterSetName = 'Set2')] + [ValidatePattern("^[a-zA-Z0-9]*$")] [string]$InputObject, # Accepts pipeline input by property name