Skip to content

Instantly share code, notes, and snippets.

Last active Feb 22, 2019
What would you like to do?
Write "Installing NServiceBus License"
$content = [xml]"<?xml version=`"1.0`" encoding=`"utf-8`"?>
<license id=`"MyId`" expiration=`"2114-06-11T04:13:03.9080905`" type=`"Standard`" ProductName=`"Royalty Free Platform License`" WorkerThreads=`"Max`" LicenseVersion=`"5.0`" MaxMessageThroughputPerSecond=`"Max`" AllowedNumberOfWorkerNodes=`"Max`" UpgradeProtectionExpiration=`"2015-06-11`" Applications=`"ServiceInsight;NServiceBus;ServicePulse;ServiceMatrix;ServiceControl;`" LicenseType=`"Royalty Free Platform License`" Edition=`"Enterprise `" Quantity=`"2`" Perpetual=`"`">
<Signature xmlns=`"`">
<CanonicalizationMethod Algorithm=`"`" />
<SignatureMethod Algorithm=`"`" />
<Reference URI=`"`">
<Transform Algorithm=`"`" />
<DigestMethod Algorithm=`"`" />
Set-ItemProperty -Path HKLM:\Software\ParticularSoftware -Name License -Force -Value $content.InnerXml
$value = Get-ItemProperty -Path HKLM:\Software\ParticularSoftware -Name License
Write "License Installed"
Write $value.PSPath
#requires -version 2.0
param (
[parameter(Mandatory=$true)] [string]$password,
[string]$type = "Release",
[string]$profile = "NServiceBus.Production",
[string]$userName = "MyDomain\ServiceBus",
[array]$binfolders = @("Sales", "Billing", "Marketing", "Finance"), #The Order is important!
[bool]$sideBySide = $false #Install multiple version, won't uninstall existing service.
if($type -ne "Debug" -and $type -ne "Release")
throw "Arguments are Release and Debug"
$ErrorActionPreference = "Stop"
$count = 0
& "./Install-License.ps1";
foreach ($binfolder in $binfolders) {
Write "Installing $binfolder"
$Path = ".\$binfolder\$type"
$Arguments = '-install {0} -serviceName={1} description={2} /username={3} /password={4}' -f $profile, $binfolder, $Description, $userName, $password
$Command = $Command + " -sideBySide"
Start-Process -Wait -NoNewWindow -FilePath $Path\NServiceBus.Host.exe -ArgumentList $Arguments;
& Net Start $binfolder
$count = $count + 1
Write "Installed $count services."
Write "Done :) Check that the services has started."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment