Export-CMCollection
Syntax
SearchByNameMandatory (Default)
Export-CMCollection
-ExportFilePath <String>
-Name <String>
[-ExportComment <String>]
[-Force]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SearchByIdMandatory
Export-CMCollection
-CollectionId <String>
-ExportFilePath <String>
[-ExportComment <String>]
[-Force]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SearchByValueMandatory
Export-CMCollection
-ExportFilePath <String>
-InputObject <IResultObject>
[-ExportComment <String>]
[-Force]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Use this cmdlet to save a collection object to a managed object format (.mof
) file.
You can then import it to the same or a different Configuration Manager site. You can use this export/import process to backup custom collections, or for development lifecycle. For example, you develop a new collection in a lab environment. Export the collection from the test environment, and then import it into the production hierarchy.
For more information, see How to manage collections in Configuration Manager .
Note
Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>
. For more information, see getting started .
Examples
Example 1: Export a collection by name
This command exports the collection named testUser to the file named collection.mof .
Export-CMCollection -Name "testUser" -ExportFilePath "C:\collection.mof"
Example 2: Export all collections
This example first uses the Get-CMCollection cmdlet to get all collections, and stores them in the allColl variable. It then loops through each collection, and exports it to a separate file. It uses the collection name ($coll.Name
) as the file name.
$allColl = Get-CMCollection
foreach ( $coll in $allcoll ) {
Export-CMCollection -InputObject $coll -ExportFilePath "D:\Export\Collections\$($coll.Name).mof"
}
Parameters
-CollectionId
Specify the ID of a collection to export. This value is the CollectionID property, for example, XYZ00012
.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
SearchByIdMandatory
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: False
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DisableWildcardHandling
This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling .
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
Specify an optional comment for the exported collection in the MOF file.
Type: String
Default value: None
Supports wildcards: False
DontShow: False
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ExportFilePath
Specify the full path for the export file. Include the file extension .mof
.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: FileName, FilePath, Path
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Force
Run the command without asking for confirmation.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ForceWildcardHandling
This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling .
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
Specify a collection object to export. To get this object, use the Get-CMCollection , Get-CMDeviceCollection , or Get-CMUserCollection cmdlets.
Type: IResultObject
Default value: None
Supports wildcards: False
DontShow: False
SearchByValueMandatory
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
-Name
Specify the name of a collection to export.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
SearchByNameMandatory
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet doesn't run.
Parameter properties
Type: SwitchParameter
Default value: False
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Microsoft.ConfigurationManagement.ManagementProvider.IResultObject
Outputs
System.Object