Create an Installer
Using an installer is one of two ways to install packages with Update Service, the other is using PowerShell cmdlets. Installer is a single executable file that contains an Update Service client and metadata such as Update Service server connection info and list of packages that are available to install with the particular installer. The installer is a lightweight "web" installer and only contains references to the packages, not the packages them selfs, they will be downloaded during installation.
Creating installer can be automated with PowerShell cmdlets or through the server management interface. For our how-to, we will do both.
PowerShell
Copy and paste the following code into a new PowerShell script, save it and run it.
$ErrorActionPreference = 'stop' Import-Module UpdateServiceServer $InstallerGuid = "462DB9A7-06F0-4034-8CEB-EBA6A1325948" if (!(Test-UssInstaller -Guid $InstallerGuid)) { New-UssInstaller -Name "My Installer" -Guid $InstallerGuid Set-UssInstallerPackage -Guid $InstallerGuid -PackageId "example-app" Get-UssInstaller -Guid $InstallerGuid -OutputDir $PSScriptRoot }
You have now created a new installer which includes the example-app package and downloaded the installer executable. Go to the script's directory ($PSScriptRoot) and you will see a new executable/installer called My Installer.exe. Try to run it and install the package.
Lets go through the code, step-by-step:
- First we assign a unique GUID (globally unique identifier) to the variable $InstallerGuid. This GUID will represent our new installer and allow us to manipulate the installer later on. No two installers can have the same GUID. There exists various tools to create GUIDs, there is one in Visual Studio or you can pick a tool online from Google.
Next, we check if the installer already exists on the server.
if (!(Test-UssInstaller -Guid $InstallerGuid))
And if it doesn't exist, we create it:
New-UssInstaller -Name "My Installer" -Guid $InstallerGuid
We also assign the example-app package from the last how-to, to the installer:
Set-UssInstallerPackage -Installer $InstallerGuid -PackageId "example-app"
Last and not least, we download an executable for the installer that is stored in the same directory as the script:
Get-UssInstaller -Installer $InstallerGuid -OutputDir $PSScriptRoot
For completeness, let's extend our script CreatePackages.ps1 from a previous how-to:
$ErrorActionPreference = 'stop' Import-Module UpdateServiceServer $ExampleApp = @{ 'Id' = 'example-app' 'Name' = 'Example App' 'Version' = '1.0' 'Commands' = @{ 'Install' = 'Package.psm1:Install-Package' 'Update' = 'Package.psm1:Install-Package' } 'InputPath' = @( Join-Path $PSScriptRoot 'example-app\*' # Add all files to package from directory. ) 'OutputDir' = (Join-Path $PSScriptRoot 'Package') } $PackagePath = New-UssPackage @ExampleApp -Force | Import-UssPackage $InstallerGuid = "462DB9A7-06F0-4034-8CEB-EBA6A1325948" if (!(Test-UssInstaller -Guid $InstallerGuid)) { New-UssInstaller -Name "My Installer" -Guid $InstallerGuid Set-UssInstallerPackage -Guid $InstallerGuid -PackageId "example-app" Get-UssInstaller -Guid $InstallerGuid -OutputDir $PSScriptRoot }
Server Management
In your server management interface:
- If the left menu is not visible, then click the hamburger symbol and the menu will appear (only necessary on small screens/windows).
- In the left menu click Installers.
- Click the + symbol (hovered: New Installer) on the top right.
- A dialog will appear to create a new installer.
- Type in a name for the installer of your choice and description and then click Submit to create a new installer.
- Now you have created an installer, but it does not include any packages to install.
- In the installer view, click the + symbol (hover: Add package to installer) on the top right.
- In the package field, select Example App and then click Submit.
- Now you've added the package to the installer.
- Click the download symbol (hovered: Download installer) to the top right.
- Run the downloaded installer executable and try to install the package.