Export all unsealed management packs

February 8, 2011 Posted by Anders Asp

Here’s a little powershell script that I use for exporting all unsealed MPs. It’s really useful to run once in a while so you have a backup of all unsealed MPs.

The script will create a new folder with the current date and store all MPs in that folder. Change the $OutPutDir variable to a folder of your choice.

Add-PSSnapin SMCMDLetSnapIn

$OutPutDir = "C:\Unsealed MPs\"

$UnsealedMPs = Get-SCSMManagementPack | ?{ ! $_.Sealed }

$CurrentDate = Get-Date
$CurrentDate = $CurrentDate.ToShortDateString()
$CompletePath = ($OutPutDir + $CurrentDate)

if ( ! (test-path  $CompletePath))
    $output = New-Item -Type Directory -Name $CurrentDate -Path $OutPutDir

$UnsealedMPs | %{
    "   Exporting: {0}" -f $_.Name 
    $_ | Export-SCSMManagementPack -directory "$CompletePath"

5 Responses to Export all unsealed management packs

Leave a Reply

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