PowerShell to restore *.cmp backup of SPWeb
Problem I need to restore *.cmp file that contains SPWeb backup. Solution # Creating case sites and import backup files # Created by Ben - 7 March 2019 Start-Transcript clear if ((gsnp "*sharepoint*" -ErrorAction SilentlyContinue) -eq $null ){asnp *sharepoint*} $caseSiteUrlUniquePattern = 'Exporting Web http://pacman' $truncateStart = '.intranet' $targetSite = 'http://pacman-test' $importLogFilename = 'Import.txt' $currentPs1Filename = $MyInvocation .MyCommand.Name $currentPs1FilePath = $MyInvocation .MyCommand.Definition $backupFolder = $currentPs1FilePath .SubString(0, $currentPs1FilePath .indexOf( $currentPs1Filename )) $importLogFilePath = $backupFolder + $importLogFilename $processedFolder = $backupFolder +'Restored\' if (!( Test-Path $importLogFilePath )) { New-item -Path $backupFolder -Name $importLogFilename -ItemType 'file' } Get-ChildItem $backupFolder -Filter *.log | Foreach ...