Skip to content

Instantly share code, notes, and snippets.

@altrive
Created November 23, 2013 18:55
Show Gist options
  • Select an option

  • Save altrive/7618509 to your computer and use it in GitHub Desktop.

Select an option

Save altrive/7618509 to your computer and use it in GitHub Desktop.
XmlElement can't pass remote command parameter.
$xmlDocument = [xml] "<root><elem>abcd</elem></root>"
$xmlElement = $xmlDocument.root
Invoke-Command localhost -ScriptBlock {
$arg = $using:xmlDocument
Write-Host ("Type={0}, Value={1}" -f $arg.GetType(), $arg.OuterXml)
}
Invoke-Command localhost -ScriptBlock {
$arg = $using:xmlElement
Write-Host ("Type={0}, Value={1}" -f $arg.GetType(), $arg) #XmlElement is not supported by PSRemiting
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment