CmdID

CmdID / PowerShell / Cmdlets / ConvertTo

ConvertTo-Xml

Creates an XML-based representation of an object. PowerShell reference

From the PowerShell reference 4 parameters

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Creates an XML-based representation of an object. The ConvertTo-Xml cmdlet creates an XML-based representation of one or more .NET objects. To use this cmdlet, pipe one or more objects to the cmdlet, or use the InputObject parameter to specify the object. When you pipe multiple objects to ConvertTo-Xml or use the InputObject parameter to submit multiple objects, ConvertTo-Xml returns a single, in-memory XML document that includes representations of all the objects. This cmdlet is similar to Export-Clixml except that Export-Clixml stores the resulting XML in a Common Language Infrastructure (CLI) file that can be reimported as objects with Import-Clixml. ConvertTo-Xml returns an in-memory representation of an XML document, so you can continue to process it in PowerShell. ConvertTo-Xml doesn't have an option to convert objects to CLI XML.

ConvertTo-Xml [-Depth <Int32>] [-InputObject] <PSObject> [-NoTypeInformation] [-As <String>] [<CommonParameters>]

Convert a date to XML

Get-Date | ConvertTo-XmlIdentify

Convert processes to XML

ConvertTo-Xml -As "Document" -InputObject (Get-Process) -Depth 3Identify

Its page in the reference: ConvertTo-Xml.

Parameters

4 in the PowerShell reference
-AsDetermines the output format. The acceptable values for this parameter are: - String - Returns a single string. - Stream - Returns an array of strings. - Document - Returns an XmlDocument object. The default value is Document.
-DepthSpecifies how many levels of contained objects are included in the XML representation. The default value is 1. For example, if the object's properties also contain objects, to save an XML representation of the properties of the contained objects, you must specify a depth of 2. The default value can be overridden for the object type in the Types.ps1xml files. For more information, see about_Types.ps1xml.
-InputObjectSpecifies the object to be converted. Enter a variable that contains the objects, or type a command or expression that gets the objects. You can also pipe objects to ConvertTo-Xml.
-NoTypeInformationOmits the Type attribute from the object nodes.