Skip to content

Instantly share code, notes, and snippets.

@agross
Last active December 20, 2015 18:48
Show Gist options
  • Save agross/6178123 to your computer and use it in GitHub Desktop.
Save agross/6178123 to your computer and use it in GitHub Desktop.
$ErrorActionPreference = 'Stop'
$scriptPath = Split-Path -parent $MyInvocation.MyCommand.Definition
Import-Module "$scriptPath\tools\deployment-tools"
Import-Module "$scriptPath\bin\NServiceBus.PowerShell.dll"
$permissions = @{
'' = @{
"FullControl" = @(
$(ConvertTo-UserName([System.Security.Principal.WellKnownSidType]::BuiltinAdministratorsSid)),
$(ConvertTo-UserName([System.Security.Principal.WellKnownSidType]::LocalSystemSid))
)
}
'bin' = @{
"ReadAndExecute" = @(
$(ConvertTo-UserName([System.Security.Principal.WellKnownSidType]::NetworkServiceSid))
)
}
'logs' = @{
"Modify" = @(
$(ConvertTo-UserName([System.Security.Principal.WellKnownSidType]::NetworkServiceSid))
)
}
}
$serviceName = "GROSSWEBER development Ops"
$endpointName = "GROSSWEBER.development.ops"
# Convert-ToUserName would translate to German here, the following works on German and English systems.
$serviceIdentity = "NT AUTHORITY\NetworkService"
$physicalPath = "$scriptPath\bin"
function Install {
Set-Permissions -RootPath $scriptPath -Permissions $permissions
Exec { & $scriptPath\tools\WebPlatformInstaller\WebpiCmd.exe /Install "/Products:NETFramework4" /SuppressReboot /AcceptEula }
Exec { & $physicalPath\NServiceBus.Host.exe /uninstall /serviceName:$serviceName }
Install-NServiceBusDTC
Install-NServiceBusMSMQ -Confirm:$false
Install-NServiceBusPerformanceCounters -Confirm:$false
Install-NServiceBusRavenDB
Exec { & $physicalPath\NServiceBus.Host.exe /install /serviceName:$serviceName /endpointName:$endpointName /username:$serviceIdentity /password:`"`" }
$service = Get-Service -Name $serviceName
$dependencies = $service.ServicesDependedOn | ForEach-Object { $_.ServiceName }
$dependencies = (@() + $dependencies + "RavenDB" + "MSMQ") -Join "/"
Exec { sc.exe config $service.ServiceName depend= $dependencies }
$service.Start()
Write-Host "Done"
}
function Uninstall {}
# Runs all command line arguments as functions.
$args | ForEach-Object { & $_ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment