Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 17778

PowerTip: Create XML with PowerShell

$
0
0

Summary: Use Windows PowerShell to create XML.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily create an XML representation of my service names and status?

Hey, Scripting Guy! Answer Use the Get-Service cmdlet to retrieve the service information, select the name and status properties,
          and pipe the results to the ConvertTo-XML cmdlet. Then to facilitate post processing of the information,
          store the results in a variable:

$xml = Get-Service | select name, Status | ConvertTo-Xml


Viewing all articles
Browse latest Browse all 17778

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>