How to Zip and Deploy a Cloudhouse Compatibility Container
Purpose
This article details how to ZIP and deploy a Cloudhouse Compatibility Container™.
Overview
Cloudhouse Containers 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 DeployZippedContainers.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.
Step-by-step process
To ZIP a Cloudhouse Container:
- Zip the contents of the Container 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 Container from the ZIP file and then run the Cloudhouse.Container.Deploy.exe command.
Example DeployZippedContainer.ps1
Please ensure you test this script, or any other script, in your environment.
<# .SYNOPSIS Utility to extract and deploy a Zipped Container .DESCRIPTION This utility will extract a Container (zipped using Explorer, WinZip or 7-Zip) into the user's %temp% directory. The Container will be extracted to %temp%\ZipName. If the unzipped Container exists, then it will be deleted (recursive delete) and replaced with the latest files extracted from zip. Once the Container has been installed the temp files will be deleted .PARAMETER sourcezip Provide the filename of the zipped Container .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 .\DeployZippedContainers.ps1 -sourcezip AppNameContainer.zip -deploycmd Cloudhouse.Container.Deployment.exe -deployargs "/deploydir c:\programdata /deploytype user /acceptEULA" Uninstall a container installed for a user in c:\programdata .\DeployZippedContainers.ps1 -sourcezip AppNameContainer.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 .\DeployZippedContainers.ps1 -sourcezip AppNameContainer.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 container exists If( -Not (Test-Path $source)) { Write-Output (-join("Zipped Container 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 Container ", $source)) Add-Type -assembly "system.io.compression.filesystem" try { [io.compression.zipfile]::ExtractToDirectory($source, $dest) Write-Output (-join("Extracted the zipped Container ", $dest)) } catch { Write-Output "`nFailed to extract the Container", $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 container from the temp directory"
Usage
To get help:
PS > help .\DeployZippedContainer.ps1
To extract AppNameContainer.zip to AppNameContainer
PS > .\DeployZippedContainer.ps1 -sourcezip AppNameContainer.zip -deploycmd Cloudhouse.Container.Deployment.exe -deployargs "/deploydir c:\programdata /deploytype user"
Disclaimer
Sample scripts are not supported under any Cloudhouse standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Cloudhouse further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Cloudhouse, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Cloudhouse has been advised of the possibility of such damages.