Skip to content

Instantly share code, notes, and snippets.

@1RedOne
Last active September 21, 2016 18:29
Show Gist options
  • Select an option

  • Save 1RedOne/9574256d0a78e6681919d7eb2eb6e1e2 to your computer and use it in GitHub Desktop.

Select an option

Save 1RedOne/9574256d0a78e6681919d7eb2eb6e1e2 to your computer and use it in GitHub Desktop.
Figure out which values are which
$sampleSyntax = ((Get-DscResource User -Syntax).Split("`n") -join "`n")
{"
UserName = [string]
[DependsOn = [string[]]]
[Description = [string]]
[Disabled = [bool]]
[Ensure = [string]{ Absent | Present }]
[FullName = [string]]
[Password = [PSCredential]]
[PasswordChangeNotAllowed = [bool]]
[PasswordChangeRequired = [bool]]
[PasswordNeverExpires = [bool]]
[PsDscRunAsCredential = [PSCredential]]
" | ConvertFrom-StringData}
$fields = $sampleSyntax.Split("`n")[2..(($sampleSyntax.Split("`n").length)-3)] | ConvertFrom-StringData
foreach ($field in $fields){
$name = $field.Keys[0]
if ($name -like "``[*"){$name = $name -replace '\['}
if ($field.Values[0] -like "*string*"){"$name should render as a textbox for strings"}
if ($field.Values[0] -like "*bool*") {"$name should render as a radio true/false"}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment