In this tutorial we're going to learn how to create an XML variable in PowerShell. A what? Yes, you read correctly, PowerShell supports XML as a native data type. Let's do this.
Creating an XML variable is almost exactly the same as creating a string variable with one syntactical difference; You need to cast the string using the XML type:
PowerShell automatically creates each child node as a property, so to get the to property we could type the following into our shell:
Or the note's body:
Pretty neat huh? This type of functionality has a lot of potential once you start getting into XML Web Services and Data Mining.