Getting Started
Architecture
NServiceBus
Transports
Persistence
ServiceInsight
ServicePulse
ServiceControl
Monitoring
Samples

Cmdlets and Aliases

Component: ServiceControl
Version: 5.x
For general information about using PowerShell with ServiceControl, including troubleshooting and licensing guidance, see Managing ServiceControl via PowerShell.

ServiceControl instance Cmdlets and Aliases

The following cmdlets and aliases are provided by the ServiceControl Management PowerShell module for the management of ServiceControl instances.

AliasCmdlet
sc-addNew-ServiceControlInstance
sc-deleteRemove-ServiceControlInstance
sc-instancesGet-ServiceControlInstances
sc-transportsinfoGet-ServiceControlTransportTypes
sc-upgradeInvoke-ServiceControlInstanceUpgrade

The following cmdlets are available for the management of ServiceControl Audit instances.

AliasCmdlet
audit-addNew-ServiceControlAuditInstance
audit-deleteRemove-ServiceControlAuditInstance
audit-instancesGet-ServiceControlAuditInstances
audit-upgradeInvoke-ServiceControlAuditInstanceUpgrade

The following cmdlets are available for the management of ServiceControl remotes.

AliasCmdlet
sc-addremoteAdd-ServiceControlRemote
sc-deleteremoteRemove-ServiceControlRemote
sc-remotesGet-ServiceControlRemotes

The following cmdlets are available for the management of ServiceControl Monitoring instances.

AliasCmdlet
mon-addNew-MonitoringInstance
mon-deleteRemove-MonitoringInstance
mon-instancesGet-MonitoringInstances
mon-upgradeInvoke-MonitoringInstanceUpgrade

The following general cmdlets and aliases are provided by the ServiceControl Management PowerShell module.

AliasCmdlet
sc-addlicenseImport-ServiceControlLicense
sc-findlicenseGet-ServiceControlLicense
sc-helpGet-ServiceControlMgmtCommands
urlacl-addAdd-UrlAcl
urlacl-deleteRemove-UrlAcl
urlacl-listGet-UrlAcls
port-checkTest-IfPortIsAvailable
user-sidGet-SecurityIdentifier

Help

All of the cmdlets have local help which can be accessed via the standard PowerShell help command

Get-Help Get-ServiceControlInstances

Adding an instance

Use the New-ServiceControlInstance cmdlet to create a new ServiceControl instance. Use the New-ServiceControlAuditInstance cmdlet to create a new ServiceControl Audit instance.

There are additional parameters available to set additional configuration options such as forwarding queues, the transport connection string, or host name.

Create a ServiceControl instance:

$serviceControlInstance = New-ServiceControlInstance `
  -Name Test.ServiceControl `
  -InstallPath C:\ServiceControl\Bin `
  -DBPath C:\ServiceControl\DB `
  -LogPath C:\ServiceControl\Logs `
  -Port 33334 `
  -DatabaseMaintenancePort 33335 `
  -Transport MSMQ `
  -ErrorQueue error1 `
  -ErrorRetentionPeriod 10:00:00:00

Create a ServiceControl Audit instance to manage an audit queue:

$auditInstance = New-ServiceControlAuditInstance `
  -Name Test.ServiceControl.Audit `
  -InstallPath C:\ServiceControl.Audit\Bin `
  -DBPath C:\ServiceControl.Audit\DB `
  -LogPath C:\ServiceControl.Audit\Logs `
  -Port 44444 `
  -DatabaseMaintenancePort 44445 `
  -Transport MSMQ `
  -AuditQueue audit1 `
  -AuditRetentionPeriod 10:00:00:00 `
  -ForwardAuditMessages:$false `
  -ServiceControlQueueAddress Test.ServiceControl

Add-ServiceControlRemote `
  -Name $serviceControlInstance.Name `
  -RemoteInstanceAddress $auditInstance.Url
The ServiceControl Audit instance must be configured with the transport address of a ServiceControl instance.

Removing an instance

Use the Remove-ServiceControlInstance cmdlet to remove a ServiceControl instance.

Remove-ServiceControlInstance -Name Test.ServiceControl -RemoveDB -RemoveLogs

Use the Remove-ServiceControlAuditInstance cmdlet to remove a ServiceControl Audit instance.

Remove-ServiceControlRemote `
 -Name Test.ServiceControl `
 -RemoteInstanceAddress http://localhost:44444/api

Remove-AuditInstance `
  -Name Test.ServiceControl.Audit
  -RemoveDB -RemoveLogs
All connected ServiceControl Audit instances should be removed before removing the ServiceControl Error instance. Use the Get-ServiceControlRemotes cmdlet to find a list of connected ServiceControl Audit instances for a given ServiceControl instance.

Upgrading an instance

The cmdlets in this section are used to upgrade the binaries of an existing instance. If the instance is running when the upgrade starts, it will be shut down during the upgrade and restarted once the upgrade is complete.

The sc-upgrade and audit-upgrade commands do not download the latest available ServiceControl version. These Powershell commandlets are bound to the version of the Particular.ServiceControl.Management module loaded.

Before the upgrade begins the configuration file of the existing version is examined to determine if all of the required settings are present. If a configuration setting is missing then the cmdlet will throw an error indicating the required additional parameter for the cmdlet.

Use the Invoke-ServiceControlInstanceUpgrade cmdlet to upgrade a ServiceControl instance to the latest binaries.

Invoke-ServiceControlInstanceUpgrade -Name InstanceToUpgrade

Use the following to find a list of all of the ServiceControl instances and their version numbers:

Get-ServiceControlInstances | Select Name, Version

Additional parameters may be required when upgrading instances. See the upgrade guide for the specific version for more details.

Use the Invoke-AuditInstanceUpgrade cmdlet to upgrade a ServiceControl audit instance to the latest binaries.

Invoke-ServiceControlAuditInstanceUpgrade -Name InstanceToUpgrade

Use the following command to find a list of all of the ServiceControl Audit instances and their version numbers:

Get-ServiceControlAuditInstances | Select Name, Version

Licensing

Copies the license file to the correct location on the file system (%PROGRAMDATA%/ParticularSoftware/license.xml) so it is available to all instances of ServiceControl installed on the machine.

Import-ServiceControlLicense License.xml

Last modified