Update Service Client Cmdlets
You can use the Update Service client cmdlets to automate the installation of packages.
How to Install?
The cmdlets will become available on your system, immediately after you run an Update Service installer, this can also be scripted.
Quick Start with PowerShell
Install Cmdlets
To install the Update Service client cmdlets using PowerShell, you need to obtain an Update Service installer. You can find available installers here. Once you have obtained the installer, run the following command:
& 'c:\path\to\installer.exe' --Silent | Out-Null
if ($LASTEXITCODE -ne 0) { throw "Install failed!" }
$env:PSModulePath = [System.Environment]::GetEnvironmentVariable("PSModulePath", "Machine")
You also have the option to retrieve an installer directly from your Update Service server and install it in one go:
Invoke-WebRequest -Uri "https://updateservice.lsretail.com/api/installScript" -UseBasicParsing | % { & ([ScriptBlock]::Create([System.Text.Encoding]::Utf8.GetString($_.Content))) }
Replace https://updateservice.lsretail.com
with the URL of your Update Service server.
Install Package
Now, let's proceed with the installation of the example-package on our system:
Install-UscPackage -PackageId 'example-package'
This package does not install any components, but it is added to the installed registry of the Update Service.
Note
The package mentioned is available on the LS Retail's Update Service server. To obtain this package and other related packages for this example, execute the following command on your server:
Copy-UssPackageFromServer -PackageId 'example-package' -SourceServer 'https://updateservice.lsretail.com'
List Installed Packages
You can view a list of installed packages on your system:
Get-UscInstalledPackage
# And filter a specific package:
Get-UscInstalledPackage -Id 'example-package'
Remove Installed Package
To uninstall the installed package:
Uninstall-UscPackage -Id 'example-package'
Package Arguments
Packages that accept arguments, can be passed using a PowerShell hashtable.
# List arguments for package (and it's dependencies).
Get-UscArguments -Id 'example-package'
$Arguments = @{
'example-package' = @{ 'Message' = 'Hello Update Service' }
}
Install-UscPackage -Id 'example-package' -Arguments $Arguments
Specific Version
Additionally, specific versions can be installed.
Install-UscPackage -Id 'example-package' -Version '1.0.0'
Instance Packages
Typically, a package can only be installed once. However, there are also what are known as "instance packages" that can be installed multiple times. These packages are identified by their InstanceName:
# Instance instance:
Install-UscPackage -Id 'example-instance' -InstanceName 'MyInstance'
# Remove Package
Remove-UscPackage -InstanceName 'MyInstance'