The both script files included in this package enable you to export and import SharePoint 2013 Design Packages using PowerShell. Pipelining can be used with both function to automate export and import processes even for large environments.

But please be careful: By now it's only tested in my dev environment!!

Please see my blog articles for details:

 

Export sample

Here you see an export command and the properties of the returned object.

 

Some export samples:

 

PowerShell
Edit|Remove
$cred = new-object System.Management.Automation.PSCredential( "domain\spfarm", (ConvertTo-SecureString -AsPlainText "Passw0rd" -Force)) 
 
$site1 = get-spsite "http://sharepoint.local/publishing" 
$site2 = get-spsite "http://sharepoint.local/sites/publishing2" 
 
$site1$site2 | Export-SPDesignPackage -UseTempFileForExportWithExtension ".wsp" -DownloadCredentials $cred -PackageName "test" 
 
$site1$site2 | Export-SPDesignPackage -ExportFileName "C:\temp\Package.wsp" -UseExportFileNumbering -IncludeSearchConfig -DisposeSiteObject -OverwriteExistingFiles 
 
 
( 
    @{PackageName="P1"; ExportFileName="C:\temp\p1.wsp"; SiteUrl="http://sharepoint.local/publishing"}, 
    @{PackageName="P2"; ExportFileName="C:\temp\p2.wsp"; SiteUrl="http://sharepoint.local/sites/publishing2"} 
) | New-ObjectFromHashtable | Export-SPDesignPackage 
 
$site2 | Export-SPDesignPackage -ExportFileName "C:\temp\publishing2.wsp"  -IncludeSearchConfig -DisposeSiteObject -OverwriteExistingFiles
 

 

 

Import sample

Here you see an import command and the properties of the returned object.

Some more input samples:

 

PowerShell
Edit|Remove
Import-SPDesignPackage -SiteUrl "http://sharepoint.local/publishing" -ImportFileName "C:\temp\publishing2.wsp" -PackageName "P2" -Apply $true 
 
( 
    @{ SiteUrl = "http://sharepoint.local/publishing"; 
       ImportFileName = "C:\temp\publishing2.wsp"; 
       PackageName = "P2"; 
       Apply=$true 
    }, 
    @{ SiteUrl = "http://sharepoint.local/sites/publishing2"; 
       ImportFileName = "C:\temp\publishing2.wsp"; 
       PackageName = "P2"; 
       Apply=$true 
    } 
) | New-ObjectFromHashtable | Import-SPDesignPackage