Creates an XML-based representation of an object. (ConvertTo-XML)

   

# NAME
ConvertTo-XML

# SYNOPSIS
Creates an XML-based representation of an object.

# SYNTAX
ConvertTo-XML [-InputObject] <psobject> [-As <string>] [-Depth <int>] [-NoTypeInformation] [<CommonParameters>]

# 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.

# PARAMETERS
-As <string>
Determines the output format. Valid values are:

-- String: Returns a single string.
-- Stream: Returns an array of strings.
-- Document: Returns an XmlDocument object.

Stream is the default.

Required? false
Position? named
Default value Stream
Accept pipeline input? false
Accept wildcard characters? false

-Depth <int>
Specifies 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.

Required? false
Position? named
Default value 1
Accept pipeline input? false
Accept wildcard characters? false

-InputObject <psobject>
Specifies 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.

Required? true
Position? 1
Default value None
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-NoTypeInformation [<SwitchParameter>]
Omits the Type attribute from the object nodes.

Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

# INPUTS
System.Management.Automation.PSObject
You can pipe any object to ConvertTo-XML.

# OUTPUTS
System.String or System.Xml.XmlDocument
The value of the As parameter determines the type of object that ConvertTo-XML returns.

# NOTES

# EXAMPLE 1

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

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

# EXAMPLE 2

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

# Description
-----------
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.

RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=135204
Export-Clixml
Import-Clixml
ConvertTo-Html
ConvertTo-Csv

C:\Windows>powershell get-help Select-XML -full

ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2014 Microsoft Corporation.

OS: Windows 10, 8.1, 8, 7, Vista / Windows Server 2016, 2012, 2008
»»»» ColorConsole









... Windows-10




Windows 10 How To

... Windows 10 FAQ
... Windows 10 How To




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

HTTP: ... PS_Windows/en/ConvertTo-XML.htm
0.186
11669

Portable use and Windows 10/11 protected folders problem!

 /

Change the CPU to 64 bit via CMD, is that possible?

 /

Wechseln Sie die Sprache oder übersetzen Sie Get-Window-Text für alle Windows-Betriebssysteme!

 /

Read / display the Windows license key via command line no hack!

 /

Netzwerklast basierendes Verhalten im Bezug auf Schlafmodus!

 /

Locate Direct X in Windows 10!

 /

How to Manage Users in Windows-8 (add, remove, enable, delete, 8.1)?

 /

Set default Font for the Desktop Short Note!

 /

Double click at any blank space, the directory goes upwards!

 /

Die Digitale Windows 11, 10, ... Desktop Uhr ohne Sperr-Bildschirm!

 /

Adjust sound volume in Windows 11?

 /

What can I do if my Windows 10 computer does not start?

 /