Skip to content

Instantly share code, notes, and snippets.

@erichexter
Created April 2, 2014 12:01
Show Gist options
  • Save erichexter/9932724 to your computer and use it in GitHub Desktop.
Save erichexter/9932724 to your computer and use it in GitHub Desktop.
PreDeploy
Write-Host "Installing foobar for $Environment"
& .\QS.CommandProcessor.exe install -instance:$Environment | Write-Host
do
{
Write-Host "Starting Command Processor for $Environment"
& .\QS.CommandProcessor.exe start -instance:$Environment | Write-Host
start-sleep 5
$service = Get-Service "QSCommandProcessor`$$Environment" -ErrorAction SilentlyContinue
} while ($service.Status -ne [System.ServiceProcess.ServiceControllerStatus]::Running)
$p = join-path . ".\qs.commandprocessor.exe" -Resolve
$c =[System.Configuration.ConfigurationManager]::OpenExeConfiguration($p)
$s=$c.GetSection("connectionStrings")
$s.SectionInformation.ProtectSection($null)
$s=$c.GetSection("appSettings")
$s.SectionInformation.ProtectSection($null)
$c.Save()
$name=foobar
$service = Get-Service "$name`$$Environment" -ErrorAction SilentlyContinue
if (($service -ne $null) -and ($service.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running))
{
Write-Host "Stopping Command Processor for $Environment"
& .\QS.CommandProcessor.exe stop -instance:$Environment | Write-Host
do
{
start-sleep 5
$service = Get-Service "$name`$$Environment" -ErrorAction SilentlyContinue
} while ($service.Status -ne [System.ServiceProcess.ServiceControllerStatus]::Stopped)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment