Skip to content

Instantly share code, notes, and snippets.

@kmhuglen
Created September 21, 2016 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmhuglen/fb66e63389f1d81694e3e5c771db211b to your computer and use it in GitHub Desktop.
Save kmhuglen/fb66e63389f1d81694e3e5c771db211b to your computer and use it in GitHub Desktop.
$UserInput= '{UserInput from "Get Incident Request"}'
$nl = [Environment]::NewLine
$content=[XML]$UserInput
$inputs = $content.UserInputs.UserInput
foreach ($input in $inputs)
{
if($($input.Answer) -like "<value*")
{
[xml]$answer = $input.answer
foreach($value in $($($answer.values)))
{
foreach($item in $value)
{
foreach ($txt in $($item.value))
{
$ListArray += $($txt.DisplayName)
}
$Array += $input.Question + " = " + [string]::Join(" ; ",$ListArray) +$nl
$ListArray = $null
}
}
}
else
{
if ($input.type -eq "enum")
{
$ListGuid = Get-SCSMEnumeration -Id $input.Answer
$Array += $($input.Question + " = " + $ListGuid.displayname) +$nl
}
else
{
$Array += $($input.Question + " = " + $input.Answer) +$nl
}
}
}
$Array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment