Skip to content

Instantly share code, notes, and snippets.

@Romiko
Last active Feb 22, 2019
Embed
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=`"`">
<name>MyName</name>
<Signature xmlns=`"http://www.w3.org/2000/09/xmldsig#`">
<SignedInfo>
<CanonicalizationMethod Algorithm=`"http://www.w3.org/TR/2001/REC-xml-c14n-20010315`" />
<SignatureMethod Algorithm=`"http://www.w3.org/2000/09/xmldsig#rsa-sha1`" />
<Reference URI=`"`">
<Transforms>
<Transform Algorithm=`"http://www.w3.org/2000/09/xmldsig#enveloped-signature`" />
</Transforms>
<DigestMethod Algorithm=`"http://www.w3.org/2000/09/xmldsig#sha1`" />
<DigestValue>myvalue=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>myvalues</SignatureValue>
</Signature>
</license>"
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.
)
clear
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
if($sideBySide)
{
$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