PowerShell Logo Small

Export-Clixml



This is the built-in help made by Microsoft for the command 'Export-Clixml', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 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 or objects and stores it in a file.

SYNTAX


Export-Clixml [-Path] <String> [-Depth <Int32>] [-Encoding <String>] [-Force] [-NoClobber] -InputObject <PSObject> [-Confirm] [-WhatIf]
[<CommonParameters>]
Export-Clixml [-Depth <Int32>] [-Encoding <String>] [-Force] [-NoClobber] -InputObject <PSObject> -LiteralPath <String> [-Confirm] [-WhatIf]
[<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Export-Clixml cmdlet creates an XML-based representation of an object or objects and stores it in a file. You can then use the
Import-CLIXML cmdlet to re-create the saved object based on the contents of that file.


This cmdlet is similar to ConvertTo-XML, 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/?LinkID=113297
ConvertTo-Html
ConvertTo-Xml
Export-Csv
Import-Clixml

REMARKS

<

Examples


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

PS C:\>"This is a test" | export-clixml sample.xml



This command creates an XML file that stores a representation of the string, "This is a test".








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

PS C:\>get-acl C:\test.txt | export-clixml -Path fileacl.xml
PS C:\>$fileacl = import-clixml fileacl.xml



This example shows how to export an object to an XML file and then create an object by importing the XML from the file.

The first command uses the Get-ACL cmdlet to get the security descriptor of the Test.txt file. It uses a pipeline operator to pass the
security descriptor to Export-Clixml, which stores an XML-based representation of the object in a file named FileACL.xml.

The second command uses the Import-Clixml cmdlet to create an object from the XML in the FileACL.xml file. Then, it saves the object in the
$FileAcl variable.