PowerShell Logo Small

ConvertTo-Xml



This is the built-in help made by Microsoft for the command 'ConvertTo-Xml', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Creates an XML-based representation of an object.

SYNTAX


ConvertTo-Xml [-InputObject] <PSObject> [-As {Stream | String | Document}] [-Depth [<Int32>]] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore |
Suspend}] [-InformationVariable [<System.String>]] [-NoTypeInformation] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The ConvertTo-Xml cmdlet creates an XML-based representation of one or more Microsoft .NET Framework 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 XML document that includes
representations of all of the objects.


This cmdlet is similar to Export-Clixml except that Export-Clixml stores the resulting XML in a file. ConvertTo-XML returns the XML, so you can continue to process it in
Windows PowerShell.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=293952
ConvertTo-Csv
ConvertTo-Html
Export-Clixml
Import-Clixml

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>get-date | convertto-xml



This command converts the current date (a DateTime object) to XML.










-------------------------- EXAMPLE 2 --------------------------

PS C:\>convertto-xml -as Document -inputObject (get-process) -depth 3



This command converts the process objects that represent all of the processes on the computer into an XML document. The objects are expanded to a depth of three levels.