Ugh, just got schooled by a .net dev:)
So the issue is that when I use an xpath to carve up an xml config file locally
and ship the System.Xml.XmlDocument
object off to a remote computer via remoting, it gets serialized, so its almost
useless at the far end.
What I plan to do is convert all the configs fanned out to the set hosts to a
string object so it does not undergo serialization.
[XML]$XML = Get-Content 'C:\Data\config.xml'
$StringWriter = New-Object System.IO.StringWriter
$XmlWriter = New-Object System.XMl.XmlTextWriter $StringWriter
$xmlWriter.Formatting = "indented"
$xmlWriter.Indentation = '4'
$xml.WriteContentTo($XmlWriter)
$XmlWriter.Flush()
$StringWriter.Flush()
$StringWriter.ToString()
A bit much to go through, but it gets what I need. I'll pass this in as an arg
to the invoke cmd and convert to an xml object
to get the nice parsing/xpath ability...
Thanks!
jlc
________________________________
From: Michael B. Smith
Sent: Thursday, February 14, 2013 5:21 PM
To: NT System Admin Issues
Subject: RE: Powershell question
ToString() doesn't work for you? Convert-* don't work for you?
I'm a little confused as to what you want to do...
From: Joseph L. Casale [mailto:[email protected]]
Sent: Thursday, February 14, 2013 7:14 PM
To: NT System Admin Issues
Subject: Powershell question
Hey guys,
I have a System.Xml.XmlDocument object I want to convert back to textual
representation so I can save it in a variable.
The .Save() method allows for a console object, anyone know how to do this for
a variable?
Thanks!
jlc
~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~
---
To manage subscriptions click here:
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to
[email protected]<mailto:[email protected]>
with the body: unsubscribe ntsysadmin
~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~
---
To manage subscriptions click here:
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to
[email protected]<mailto:[email protected]>
with the body: unsubscribe ntsysadmin
~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~
---
To manage subscriptions click here:
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin