Import a Package to Server
Package archives are simply imported to the server with the Import-UssPackage
cmdlet.
Lets extend the script from previous step, by piping the results of New-UssPackage
to Import-UssPackage
, as following:
New-UssPackage @ExampleApp -Force | Import-UssPackage
Now, run the script, it should look like this:
$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 'Output')
}
New-UssPackage @ExampleApp -Force | Import-UssPackage
Note
Here we are assuming that the Update Service server is running on the same machine as we run the script, if you are running the script from another machine, the Import-UssPackage
accepts the parameters -Server and -Port.