In this blog post I am going to describe how to export and import different content within ConfigMgr using PowerShell.  I’ve been exploring how to get content from one site server to another as I don’t like repeating work.  I started with connecting my PowerShell ISE environment to ConfigMgr using the ISE add-in written by ConfigMgrDogs  you can find the blog post here.  One ISE is loaded and the add-in is launched, you will see that you have successfully connected when you see a prompt with your site code.  Like so..


(You can of course simply launch the ISE environment from the ConfigMgr console in later versions) Now the fun begins.  The first thing I’m going to do is to search for any commands within the Configuration Manager PowerShell Module that contains the key word “export”.  Using the following command

Get-Command –Module ConfigurationManager | Where Name –Like *export*


Next I’m going to examine Export-CMCollection.  I like the idea of taking my collections with me so I don’t have to rewrite the queries at other sites.  Lets take a look at the examples for the command by throwing Get-Help Export-CMCollection –examples.  (You may need to update your help files at this stage).


OK so pretty straight forward really, it exports collections to a MOF file.    Actually quite handy for me because my non-site specific collections I want to take with me to another site all have the same name prefix of “All” like this…


… so I’ll put a command together using some form of wildcard.  Here is the command I used:

Export-CMCollection -Name “All*” -ExportFilePath “\{SERVER-UNC-PATH}ExportedCollections.mof” –Verbose –ForceWildcardHandling

(obviously change your export path in your situation and the wildcard against the Name parameter)


I can now see I have a MOF File inside the folder I specified! From the above output obviously my wildcard has worked and every collection with a prefix of “All” has been exported to the MOF. Awesome!  You can of course specify individual names for collections if you want to be more specific than I have been above.


I can now transfer that to another site and use Import-CMCollection to import it using the following command

Import-CMCollection –ImportFilePath “\{SERVER-UNC-PATH}ExportedCollections.mof” –Verbose

Verbose output is too long to take a screen shot of as there are three or four lines per collection but that will run successfully.  It will error out if you try to create a collection that already exists, however, so be careful what you export and know the environment you are importing to.  In my case (and the above example) I had an error for this very reason.  This is because I already had a “All Systems”, “All Unknown Computers” and “All Desktop and Server Clients” collections as standard.  (Probably chose the wrong naming convention for my personal ones there but never mind).  I fixed this by manually editing the MOF file but I could have gone back and spent more time being selective about what I was exporting in the first place by changing up my PowerShell command.

So that’s Collections, lets try something else.  How about Applications?

Exploring the command results from Get-Command –Module ConfigurationManager | Where Name –Like *export*  I can see there is a Export-CMApplication cmdlet.  Lets run Get-Help on this and see what we are faced with…


Hmmm… not sure why I would “OmitContent” when exporting an application so lets try to export all my applications to a zip folder taking tips from the above without omitting any content.

Export-CMApplication -Name * –Path “\{SERVER-UNC-PATH}” –Verbose –ForceWildcardHandling



I can see that after this completed, I have two new objects in the EXPORTEDCONTENT$ folder.  a ZIP file and a folder with content totalling 17GB in my case.


Inside the folder ExportedApplications_files I can see that I have all the distribution point content folders with unique names and subsequently, all the content for the applications.


It is possible for you to export individual applications too, you would simply specify a name rather than a wild card in the above examples.  You could, for example, start to build up a collection of successfully tested and exported applications and take them with you from server to server, saving you the hassle of redoing work over and over – depending on the nature of your role.

OK excellent, so I transfer them to another ConfigMgr server and then Import-CMApplication to import the applications.

Import-CMApplication -FilePath “\{SERVER}sources$ExportedExportedApps.Zip” –Verbose


Hmm… not a very verbose output haha.  But still! If I now look in my labs blank applications node I see 106 applications I Imported.


Sorry, but that is cool!  It wont remember the folder organisation inside the console you had before (if you had it) but it’ll save you so much time going over the same things.

You can use the ‘Import application’ right click menu option in the console too


Feel free to try that in your own situation.

What’s next?  Lets try packages!

Without going over the same ground (and screenshots) as above, I put together the following command to export my packages:

Export-CMPackage -Name * -ExportFilePath “\{SERVER}ExportedContent$” –Verbose –ForceWildcardHandling

It runs successfully, in this instance giving quite nice verbose output to the console.  I transfer the files across to another ConfigMgr server and throw this command to import them:

Import-CMPackage -FilePath “\{SERVER}sources$ExportedExportedAPackages.Zip” –Verbose

Again you can also use the Import Package option from the right click menu in the console to import selectively.


OK I’ll go through one more.  I’m sure that by now I have given you the tools to explore these commands yourself.  Lets examine Export-CMTaskSequence

This time I’m going to use the following command to export all my task sequences:

Export-CMTaskSequence -Name “*” -ExportFilePath “\{SERVER-UNC-PATH}” -Verbose -ForceWildcardHandling

This one has a “gotcha” though.  It will fail to import the task sequence if it cannot resolve the dependencies.  You’ll need to examine the dependencies of the task sequence and ensure you follow the export steps above to grab what you need.  If you run the following command..

Import-CMTaskSequence -ImportFilePath \{SERVER-UNC-PATH}” –Verbose

and it completes successfully, but yet you see no Task Sequences appear, it probably has a dependency error.  For some reason this isn’t outputted to the PowerShell window.  Most likely, the dependency error is due to a missing operating system.  There is no cmdlet for exporting an operating system (why?) and since 99% of task sequences are going to need an operating system its my guess that you’ll probably receive the same errors and frustrations I did.  There is however a saving grace.  A simple one really.  The –IgnoreDependency  switch.  Put this on the end of your command and it wont give a damn about missing dependant operating systems or driver packages (or anything else for that matter) and you’ll be on your own to get them to work after they’re imported.

Import-CMTaskSequence -ImportFilePath \{SERVER-UNC-PATH}” –Verbose –IgnoreDependency



*Victory fist pump*

You can follow the above steps to explore all the other export commands shown in the Get-Command query demonstrated earlier in the blog post and use the examples to export and import different kinds of content in your own environments.

I hope this has been useful to you and thanks for reading.


0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *