Skip to content

Instantly share code, notes, and snippets.

@Romiko
Created February 17, 2015 00:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Romiko/8050b9fb8904db46d0dd to your computer and use it in GitHub Desktop.
Save Romiko/8050b9fb8904db46d0dd to your computer and use it in GitHub Desktop.
Powershell install NServicebus
#requires -version 2.0
param (
[parameter(Mandatory=$true)] [string]$password,
[string]$type = "Release",
[string]$profile = "NServiceBus.Production",
[string]$userName = "IPO\ServiceBus",
[array]$binfolders = @("SB.Pacs.Pollers","SB.Orders.ScannedDocuments", "SB.Billing.SaveOrderParts", "SB.OrderService.SaveOrders", "SB.Orders.ProcessDicomImages"), #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} -dependsOn=RavenDB /username={3} /password={4}' -f $profile, $binfolder, $Description, $userName, $password
if($sideBySide)
{
$Command = $Command + " -sideBySide"
}
Remove-Item $Path\ServiceControl.Plugin.*
Start-Process -Wait -NoNewWindow -FilePath $Path\NServiceBus.Host.exe "-uninstall"
Start-Process -Wait -NoNewWindow -FilePath $Path\NServiceBus.Host.exe -ArgumentList $Arguments;
& Net Start $binfolder
& sc.exe config $binfolder start= delayed-auto
$count = $count + 1
}
Write "Installed $count services."
Write "Done :) Check that the services has started and check log files."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment