How to export the DCM baseline from one hierarchy and import to another in a bulk

 

we have scenarios where we might be needs to create and test base lines in lab and import them to production. We can use migration but if only base lines are needed to be imported these are the steps. 

 

How to export

=============

 

1. First need to launch the PowerShell for configuration manager

 

                                   clip_image002

 

2. Save the below script as a .ps1 file

 

Script to export

=============

 

$data = Get-CMBaseline

$path = "<Location To save the cab file >"

foreach ($l in $data)

{

        $p= $path + $l.LocalizedDisplayName + ".cab"

        write-host Exporting Base line $l.LocalizedDisplayName to Path $p ....

        Export-CMBaseline -Name $l.LocalizedDisplayName -Path $p

}

  write-host Export finished. Please check the path $path

 

===========================

3. Make sure that you set the execution policy to unrestricted (Set-ExecutionPolicy Unrestricted)

4. Change the path in the script (eg :   $path = "\\CMSITESERVER\ExportCM\" )

5. Once executed from the PowerShell it will start exporting one by one and once done it will give you the finished command. (Time would vary as per the no of baselines and CI you have)

 

                                    clip_image004

 

 

Now copy the data in the path above to the Configuration Manager 2012 R2 sever where you need to import

 

How to import

=============

1. Save the below script as a .ps1 file

Script to export

==============

$path = "<Location where cab files are stored>"

$data= Get-ChildItem -Path $path

foreach ($l in $data)

{

Write-Host Importing $l.FullName .....

Import-CMBaseline -FileName $l.FullName -DuplicateWhileImporting -Force

}

write-host --------------Import Finished----------------

 

2. Launch the Configuration Manger 2012 R2 PowerShell and then

3. Make sure that you set the execution policy to unrestricted (Set-ExecutionPolicy Unrestricted)

4. Change the path in the script (eg: $path = "C:\temp\ExportCM\" )

5. Execute the import script

 

clip_image001

 

 

 

Once this done all will be imported

 

This posting /Script is provided "AS IS" with no warranties and confers no rights