Okay, so I know what .Net is, but how was I supposed to know it was this powerful. For anyone who has every worked with xml in VBScript… I feel your pain. With that knowledge of the headache, that was the “Msxml2.DOMDocument” com object. I have avoided XML like the plague. Problem is I was completely oblivious to what “.Net support” really meant! I have several projects at work where I use PowerShell to “interact” with REST based web services. Not wanting to take that XML dive, I requested “PowerShell hooks”, and was obliged.
When our programmers asked me, what I wanted returned? I told them to give me a CSV in the format of a custom PS Object. At the time, this seemed a no brainier. Not only do I not have to worry about WSDL/ADO/XML, but also the data would stay objectized.
It worked GREAT that was until I started to manipulate large data sets. Then my simple system fell apart. Downloading and saving that CSV file, before I could import that data. Was simply too much, and was drastically degrading performance. Therefore, I asked the question on the PowerShell community forums about optimizing such a task. The response I got lead me to crack open Bruce’s PowerShell in Action. Low and behold, where has .Net been all my life!
Posted By bsonposh on 07/06/2008 10:51 AM
Actually… the *-clixml are meant for serializing and deserializing objects. Import-cliXML expects a VERY specific format.
If you want to “import” XML you can just type it
[XML]$myxml = < some data >
That is it… Just by type casting your object with [xml] the .net framework does the rest. Not only is it easier then my custom CSV’s but its twice as fast!