Cloudhouse Alchemy Compatibility Packages can be compressed to reduce the time taken to copy them across the network or for storing them as a single file on file shares.
The example DeployZippedPackage.ps1 shown below can be used by deployment teams from within Microsoft Endpoint Configuration Manager/SCCM or other deployment tools to extract and then run the deployment command.
Process to ZIP a Compatibility Package
- Zip the contents of the Compatibility Package's folder (not the parent folder) using Windows Explorer or a compression program such as 7-Zip.
- Create a PowerShell script like the one below to extract the Compatibility Package from the ZIP file and then run the Cloudhouse.Container.Deploy.exe command.
Example DeployZippedPackage.ps1
Please ensure you test this script, or any other script, in your environment.
LEWIS NEW
<# .SYNOPSIS Utility to extract and deploy a Zipped Compatibility Package .DESCRIPTION This utility extracts a Cloudhouse Alchemy Compatibility Package (zipped using Explorer, WinZip or 7-Zip) into the user's %temp% directory. The Compatibility Package will be extracted to %temp%\ZipName. If the unzipped Compatibility Package exists, it will be deleted (recursive delete) and replaced with the latest files extracted from zip. Once the Compatibility Package has been installed, the temp files will be deleted .PARAMETER sourcezip Provide the filename of the zipped Compatibility Package .PARAMETER deploycmd Provide the name of the Cloudhouse utility, e.g. Cloudhouse.Container.Deployment.exe .PARAMETER deployargs Provide the args to be passed to depoyment tool. Please note if the path you want to deploy to contains a space you must add single quotes around the arguments provided. .EXAMPLE User deployment to c:\programdata .\DeployZippedPackage.ps1 -sourcezip AppNamePackage.zip -deploycmd Cloudhouse.Container.Deployment.exe -deployargs "/deploydir c:\programdata /deploytype user /acceptEULA" Uninstall a Compatibility Package installed for a user in c:\programdata .\DeployZippedPackage.ps1 -sourcezip AppNamePackage.zip -deploycmd Cloudhouse.Container.Deployment.exe "/deploytype user /uninstall" Machine deployment to c:\program files, please note you MUST use additional single quotes to ensure the space in path is handled correctly .\DeployZippedPackage.ps1 -sourcezip AppNamePackage.zip -deploycmd Cloudhouse.Container.Deployment.exe '"/deploydir c:\programdata /deploytype Machine /acceptEULA"' #> Param( [Parameter(Mandatory=$True)][String]$sourcezip, [Parameter(Mandatory=$True)][String]$deploycmd, [Parameter(Mandatory=$True)][String]$deployargs ) $current_path = Get-Location $source = Join-Path -Path $current_path -ChildPath $sourcezip # Make sure the zipped package exists If( -Not (Test-Path $source)) { Write-Output (-join("Zipped Compatibility Package doesn't exist, exiting ", $source)) exit } #set destination directory to %temp%\sourcezip $container_path = ([System.Io.Path]::GetFileNameWithoutExtension($sourcezip)) $dest = $env:temp $unzipdest = Join-Path -Path $env:temp -ChildPath $container_path If(Test-path $unzipdest) { Write-Output (-join("Destination already exists, deleting: ", $dest)) Remove-Item $unzipdest -recurse } # extract the zip archive Write-Output (-join("Extracting the Compatibility Package ", $source)) Add-Type -assembly "system.io.compression.filesystem" try { [io.compression.zipfile]::ExtractToDirectory($source, $dest) Write-Output (-join("Extracted the zipped Compatibility Package ", $dest)) } catch { Write-Output "`nFailed to extract the Compatibility Package", $PSItem } $cmd = [System.IO.Path]::Combine($unzipdest, $deploycmd) $command = "$cmd $deployargs" Write-Output "Executing command: ", $command Invoke-Expression $command #Remove-Item $dest -recurse #Write-Output "Deleted the extracted Compatibility Package from the temp directory"
OLD SCRIPT BELOW
<# .SYNOPSIS Utility to extract and deploy a Zipped Compatibility Package .DESCRIPTION This utility will extract a Cloudhouse Alchemy Compatibility Package (zipped using Explorer, WinZip or 7-Zip) into the user's %temp% directory. The Compatibility Package will be extracted to %temp%\ZipName. If the unzipped Compatibility Package exists, it will be deleted (recursive delete) and replaced with the latest files extracted from zip. Once the Compatibility Package has been installed, the temp files will be deleted .PARAMETER sourcezip Provide the filename of the zipped Compatibility Package .PARAMETER deploycmd Provide the name of the Cloudhouse utility, e.g. Cloudhouse.Container.Deployment.exe .PARAMETER deployargs Provide the args to be passed to depoyment tool. Please note if the path you want to deploy to contains a space you must add single quotes around the arguments provided. .EXAMPLE User deployment to c:\programdata .\DeployZippedPackage.ps1 -sourcezip AppNamePackage.zip -deploycmd Cloudhouse.Container.Deployment.exe -deployargs "/deploydir c:\programdata /deploytype user /acceptEULA" Uninstall a Compatibility Package installed for a user in c:\programdata .\DeployZippedPackage.ps1 -sourcezip AppNamePackage.zip -deploycmd Cloudhouse.Container.Deployment.exe "/deploytype user /uninstall" Machine deployment to c:\program files, please note you MUST use additional single quotes to ensure the space in path is handled correctly .\DeployZippedPackage.ps1 -sourcezip AppNamePackage.zip -deploycmd Cloudhouse.Container.Deployment.exe '"/deploydir c:\programdata /deploytype Machine /acceptEULA"' .LINK https://docs.cloudhouse.com/280111-deploying-zipped-containers #> Param( [Parameter(Mandatory=$True)][String]$sourcezip, [Parameter(Mandatory=$True)][String]$deploycmd, [Parameter(Mandatory=$True)][String]$deployargs ) $current_path = Get-Location $source = Join-Path -Path $current_path -ChildPath $sourcezip # Make sure the zipped package exists If( -Not (Test-Path $source)) { Write-Output (-join("Zipped Compatibility Package doesn't exist, exiting ", $source)) exit } #set destination directory to %temp%\sourcezip $container_path = ([System.Io.Path]::GetFileNameWithoutExtension($sourcezip)) $dest = Join-Path -Path $env:temp -ChildPath $container_path If(Test-path $dest) { Write-Output (-join("Destination already exists, deleting: ", $dest)) Remove-Item $dest -recurse } # extract the zip archive Write-Output (-join("Extracting the Compatibility Package ", $source)) Add-Type -assembly "system.io.compression.filesystem" try { [io.compression.zipfile]::ExtractToDirectory($source, $dest) Write-Output (-join("Extracted the zipped Compatibility Package ", $dest)) } catch { Write-Output "`nFailed to extract the Compatibility Package", $PSItem } $cmd = [System.IO.Path]::Combine($dest, $deploycmd) $command = "$cmd $deployargs" Write-Output "Executing command: ", $command Invoke-Expression $command #Remove-Item $dest -recurse #Write-Output "Deleted the extracted Compatibility Package from the temp directory"
Usage
To get help:
PS > help .\DeployZippedPackage.ps1
To extract AppNamePackage.zip to AppNamePackage
PS > .\DeployZippedPackage.ps1 -sourcezip AppNamePackage.zip -deploycmd Cloudhouse.Container.Deployment.exe -deployargs "/deploydir c:\programdata /deploytype user"