Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ploegert/11006848 to your computer and use it in GitHub Desktop.

Select an option

Save ploegert/11006848 to your computer and use it in GitHub Desktop.
POSH - Search XML Object for non-empty value
function get-XMLObjectChild ([xml] $envXml)
{
# try
#{
$h=@{}
#$envXml.Environment.deploy.PSRemote.GetEnumerator() | %{$h[$_.name]=$_.value }
$envXml1 = $envXml.SelectNodes("Environment/deploy/PSRemote")
$envXml1
$envXml1.GetEnumerator() | %{$h[$_.name]=$_.value }
$errorstate=$false
$h
$h.keys | ? { $h[$_]; if ($h[$_] -eq "")
{
write-host "$_ has Invalid parameter" -foregroundcolor red;
$errorstate=$true
} }
write-host "Mem: "$h.MaxMemoryPerShellMB
write-host "trusted: "$h.trustedserver
write-host "user: "$h.MaxShellsPerUser
#}
#catch
#{
# write-host "error"
#}
}
$envXml = [xml](Get-Content -Read 10kb "C:\Tools\Panoptix.Package.Install\env.xiodev.xml")
Assert-PSRemote $envXml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment