Skip to content

Make a copy of a service

This article describes how to make a copy of an existing service and its associated process using ZervicePoint PowerShell Management.

Set the ZervicePoint Powershell environment variables (ZPAPIURL, ZPAPIADFSHOST and ZPAPIAUDIENCEURI) if not already set

$env:ZPAPIURL = "https://zervicepoint.dev.local:30000/Store"
$env:ZPAPIADFSHOST = "authx.dev.zipper.se"
$env:ZPAPIAUDIENCEURI = "https://zervicepoint.dev.local/"

Import the ZervicePoint Powershell module

Import-Module "C:\Program Files\Zipper\ZervicePoint\PowerShell\ZervicePoint.WebApi.PowerShell"

Acquire a security token from your ADFS server

Not required if you are using an API Key

Get-ZPSecurityToken | Set-ZPSecurityToken

Get the service you want to make a copy of, and its associated process

$service = Get-ZPService | Where { $_.Name -Eq "ServiceToCopy" }
$process = Get-ZPProcess -UniqueId $service.ProcessUniqueId

Create a new process with a different name

$process.Name = "NewServiceName"
$newprocess = New-ZPProcess -Object $process -PassThru

Create a new service with a new name, displayname and process reference

$service.Name = "NewServiceName"
$service.DisplayName["en-US"] = "New display name"
$service.DisplayName["sv-SE"] = "Nytt visningsnamn"
$service.ProcessUniqueId = $newprocess.UniqueId
$newservice = New-ZPService -Object $service -PassThru