Import a Package to Server
Package archives are simply imported to the server with the Import-GocsPackage
cmdlet.
Lets extend the script from previous step, by piping the results of New-GocsPackage
to Import-GocsPackage
, as following:
New-GocsPackage @ExampleApp -Force | Import-GocsPackage
Now, run the script, it should look like this:
$ErrorActionPreference = 'stop'
Import-Module GoCurrentServer
$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-GocsPackage @ExampleApp -Force | Import-GocsPackage
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-GocsPackage
accepts the parameters -Server and -Port.