Export-Clixml
Additional Resources for Export-Clixml |
Saving Data as an XML File http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/export-clixml.mspx
|
SYNOPSIS
Creates an XML-based representation of an object or objects and stores it in a file.
SYNTAX
Export-Clixml [-path] <string> -inputObject <psobject> [-depth <int>] [-force] [-encoding <string>] [-noClobber] [-whatIf] [-confirm] [<CommonParameters>]
DETAILED DESCRIPTION
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 recreate the saved object based on the contents of that file.
PARAMETERS
-path <string>
Specifies the path to the file where the XML representation of the object will be stored.
Required? |
true |
Position? |
1 |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
true |
-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.
Required? |
true |
Position? |
named |
Default value |
|
Accept pipeline input? |
true (ByValue) |
Accept wildcard characters? |
false |
-depth <int>
Specifies how many levels of contained objects should be included in the XML representation. The object being exported might have properties that are themselves objects. If you want to save an XML representation of the properties of those contained objects, you must specify a depth of 2. The contained object may itself include properties that are objects. To save a representation of the properties of those objects you will have to increase the depth to 3 and so on. If the object being exported has a type-specific depth specified in the *.types.psxml files, it will be used if you do not specify the Depth parameter.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
-force <SwitchParameter>
Causes the cmdlet to clear the read-only attribute of the output file if necessary. The cmdlet will attempt to reset the read-only attribute when the command completes.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
-encoding <string>
Specifies the type of encoding for the target file. Valid values are: ASCII, UTF8, UTF7, UTF32, Unicode, BigEndianUnicode, Default, and OEM.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
-noClobber <SwitchParameter>
Ensures that the cmdlet does not overwrite the contents of an existing file. By default, if a file exists in the specified path, Export-Clixml overwrites the file without warning.
Required? |
false |
Position? |
named |
Default value |
False |
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
-whatIf
Describes what would happen if you executed the command without actually executing the command.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
-confirm
Prompts you for confirmation before executing the command.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. For more information, type, "get-help about_commonparameters".
INPUT TYPE
Object
NOTES
For more information, type "Get-Help Export-Clixml -detailed". For technical information, type "Get-Help Export-Clixml -full".
When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".
EXAMPLE 1
"This is a test" | export-clixml smpl.xml
This command creates an XML file that stores a representation of the string, "This is a test".
EXAMPLE 2
get-acl C:\test.txt | export-clixml -Path testacl.xml
$testacl = import-clixml testacl.xml
This command stores a representation of the object returned by the Get-Aclcmdlet, which contains information about the security descriptor on the C:\test.txt file. The output from Get-Acl is piped to Export-Clixml, which stores an XML-based representation of the object in a file named testacl.xml. In the second line of the command, the Import-Clixml cmdlet is used to retrieve the stored representation and recreate the object, storing it in the $testacl variable.
RELATED LINKS