XML ( eXtensible Markup Language )
 
XML stands for eXtensible Markup Language. XML is a markup language much like HTML ( HypeText Markup Language ). XML is used for storing and transporting of data. It is in human readable format. File extension for XML is “.xml”. Let’s look at how we can work with XML using Windows PowerShell. Below are some of the examples.
 
 
 
 
Find All Xml Cmdlets in PowerShell
 
 
Use Help Cmdlet to find out all the Xml Cmdlets in Windows PowerShell
 
Example
 
 
PS C:\ > Get-Help *xml*
![XML]()
The above Cmdlet returned all the Cmdlets matching with the word “xml”.
 
 
Export-Clixml
 
 
Use Export-Clixml Cmdlet to create an Xml based representation of an object and store it in a file.
 
Example
 
 
PS C:\ > Get-Process | Export-Clixml -Path C: \SampleFile.xml
![XML]()
The above Cmdlet gets list of processes and stores it in ExampleFile in C: drive.
 
Path is a mandatory parameter here. You need to specify the location of the file you want to create.
 
 
 
 
Verify
 
 
Once we export an Xml, we can verify it by navigating to the location we specfied during the export process. In this example, I specifid C: drive.
 
So, if I navigate to my C: drive and look for ExampleFile.xml file, I should see that Xml file.
 
As you can see below, I have found the file in My C: drive. Thus, the Export process was successful.
![XML]()
Image
Exported Xml file Contains Data about List of Processes.
 
Note
You can also verify it from PowerShell using Notepad. Use the below Cmdlet. It will open up the Xml file in Windows PowerShell.
 
PS C:\ > notepad C:\ExampleFile.Xml
 
 
Import-Clixml
 
 
Import-Clixml Cmdlet imports a CLIXML file and creates corresponding objects in Windows PowerShell.
 
Example
 
 
PS C:\ > Import-Clixml C:\ExampleFile.xml
![XML]()