Creating the Migration Package for Portal Upgrade
While performing portal upgrade, the migration package (migrate.zip) generated from an older version of TPC (prior to 6.1.144.168) is not compatible and cannot be directly imported into the new TPC version 6.1.144.168.
The topics in this section provide information on creating a compatible version of the migration package which can be used to import the portal files successfully to the TPC version 6.1.144.168.
-
Perform the following steps only for generating a compatible migration package from migration packages created from the TPC version older than 6.1.144.168.
-
If both source and target environments are already running 6.1.144.168, the migration package can be imported directly without running the script.
Prerequisites
On the system where the migration package needs to be generated, ensure that:
-
PowerShell is installed.
-
The migration package, migrate.zip, file is available. The migrate.zip is the backup of the files from the old portal version.
-
A temporary working folder (e.g. MigrationFix) is created for running the script and generating the new migration package.
Generate the Compatible Version of the Migration Package
-
Open a text editor (e.g. Notepad), add the following script, and save the file as Repack.bat in the temporary working folder (e.g. MigrationFix).
Copy@echo off
setlocal enabledelayedexpansion
echo ==================================================
echo [START] Repack Process (_168)
echo ==================================================
:: Paths
set BASE_DIR=%~dp0
set SOURCE_ZIP=%BASE_DIR%migrate.zip
set EXTRACT_DIR=%BASE_DIR%migrate
set OUTPUT_ZIP=%BASE_DIR%migrate_168.zip
echo [INFO] Base Directory: %BASE_DIR%
echo [INFO] Source Zip: %SOURCE_ZIP%
echo [INFO] Extract Folder: %EXTRACT_DIR%
echo [INFO] Output Zip: %OUTPUT_ZIP%
echo.
:: Step 1: Validate zip
echo [STEP 1] Checking if migrate.zip exists...
if not exist "%SOURCE_ZIP%" (
echo [ERROR] migrate.zip not found!
exit /b 1
)
echo [OK] Found migrate.zip
echo.
:: Step 2: Clean extract folder
echo [STEP 2] Preparing extraction folder...
if exist "%EXTRACT_DIR%" (
echo [INFO] Removing existing folder...
rmdir /s /q "%EXTRACT_DIR%"
)
mkdir "%EXTRACT_DIR%"
echo [OK] Folder ready
echo.
:: Step 3: Extract
echo [STEP 3] Extracting archive...
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"Write-Host '[PS] Starting extraction...'; ^
Expand-Archive -Path '%SOURCE_ZIP%' -DestinationPath '%EXTRACT_DIR%' -Force; ^
Write-Host '[PS] Extraction completed.'"
:: Count files after extraction
for /f %%A in ('dir /s /b "%EXTRACT_DIR%" ^| find /c /v ""') do set FILE_COUNT=%%A
echo [INFO] Total extracted items: !FILE_COUNT!
echo.
:: Step 4: Remove old zip
echo [STEP 4] Checking existing migrate_168.zip...
if exist "%OUTPUT_ZIP%" (
echo [INFO] Deleting old migrate_168.zip...
del "%OUTPUT_ZIP%"
)
echo [OK] Ready for repack
echo.
:: Step 5: Repack
echo [STEP 5] Repacking files into migrate_168.zip...
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"Add-Type -AssemblyName System.IO.Compression; ^
$sourcePath = '%EXTRACT_DIR%'; ^
$destinationPath = '%OUTPUT_ZIP%'; ^
Write-Host '[PS] Source:' $sourcePath; ^
Write-Host '[PS] Destination:' $destinationPath; ^
function Add-DirectoryToZip { ^
param ( ^
[System.IO.Compression.ZipArchive]$Zip, ^
[string]$SourceDir, ^
[string]$EntryRoot = '', ^
[System.IO.Compression.CompressionLevel]$CompressionLevel = [System.IO.Compression.CompressionLevel]::Optimal ^
); ^
Write-Host '[PS] Processing:' $SourceDir; ^
foreach ($file in Get-ChildItem -Path $SourceDir -File) { ^
$entryName = ($EntryRoot + $file.Name).Replace('\', '/').TrimStart('/'); ^
Write-Host ('[PS] Adding file: ' + $entryName); ^
$entry = $Zip.CreateEntry($entryName, $CompressionLevel); ^
$destination = $entry.Open(); ^
$fileStream = [System.IO.File]::OpenRead($file.FullName); ^
$fileStream.CopyTo($destination); ^
$fileStream.Dispose(); ^
$destination.Dispose(); ^
} ^
foreach ($dir in Get-ChildItem -Path $SourceDir -Directory) { ^
Add-DirectoryToZip -Zip $Zip -SourceDir $dir.FullName -EntryRoot ($EntryRoot + $dir.Name + '/') -CompressionLevel $CompressionLevel; ^
} ^
}; ^
$zipFileStream = [System.IO.File]::Open($destinationPath, [System.IO.FileMode]::Create); ^
$zipArchive = New-Object System.IO.Compression.ZipArchive($zipFileStream, [System.IO.Compression.ZipArchiveMode]::Create); ^
Add-DirectoryToZip -Zip $zipArchive -SourceDir $sourcePath -EntryRoot ''; ^
$zipArchive.Dispose(); ^
$zipFileStream.Dispose(); ^
Write-Host '[PS] Repack completed successfully.'"
echo.
:: Step 6: Final validation
echo [STEP 6] Validating output...
if exist "%OUTPUT_ZIP%" (
for %%A in ("%OUTPUT_ZIP%") do echo [OK] Output Size: %%~zA bytes
echo [SUCCESS] migrate_168.zip created successfully
) else (
echo [ERROR] Output zip was not created!
exit /b 1
)
echo.
:: Optional cleanup
echo [STEP 7] Cleaning temporary folder...
rmdir /s /q "%EXTRACT_DIR%"
echo [OK] Cleanup done
echo ==================================================
echo [END] Process Completed Successfully
echo ==================================================
pause -
In the temporary working folder, add the migration.zip file generated from the old portal version.
-
Double-click the Repack.bat file script to run the batch file.
The compatible version of the migration package is generated and saved as migration_168.zip in the temporary working folder.
The new migration package, migration_168.zip, can now be used to successfully import the portal files into the TPC 6.1.144.168 environments.
Best Practices
-
Always run the script in a temporary working folder.
-
Keep the original migrate.zip unchanged for backup.
-
Use the generated migration_168.zip for importing into TPC 6.1.144.168.
Troubleshooting Tips
Topics in this section provide information and resolution for some of the common errors that you may run into while generating the compatible version of the migration package.
Resolution
-
Install PowerShell.
-
Ensure it is available in the system PATH.
Resolution
-
Ensure both migrate.zip and repack.bat exist in the same folder.
Causes
-
The migration package is corrupted.
-
The folder where the repack.bat file is running does not have the required permissions.
Resolution
-
Download the migration package again from the old portal version.
-
Run the script in a folder where you have write permissions.