BSA version 8.3
I have a PowerShell script for restarting or re-configuring required services. In most cases the script works as expected, however, in some cases the service will not start. In these cases I catch the error and stop the script, however, this is not caught by BL as a terminating error and it shows up in the deploy status as green (successfull).
How do I get this caught correctly?
|Warning||May 27, 2015 12:30:53 PM||[stderr: 2]||Unable to start Service HBG_DDNA|
|Warning||May 27, 2015 12:30:53 PM||+ CategoryInfo : OperationStopped: (Unable to start Service HBG_D|
|Warning||May 27, 2015 12:30:53 PM||+ FullyQualifiedErrorId : Unable to start Service HBG_DDNA|
|Warning||May 27, 2015 12:30:53 PM||+ Throw <<<< "Unable to start Service " +$ServiceName|
|Warning||May 27, 2015 12:30:53 PM||At C:\windows\temp\Set-RequiredService.ps1:43 char:8|
|Info||May 27, 2015 12:30:49 PM||Deploy Apply Job (Pre-Execute):hbgary-wed8 @2015-05-27 12:29:51:481-0700; Server:sj1gwm054.corp.adobe.com; PkgID:"fe6fe6cb-0a5d-440f-8f22-eb0a28594bf6-2482568.2"; UUID:dd7dc9eb675538c2a42ae9f955860ff1|
|Warning||May 27, 2015 12:30:53 PM||DNA:String) , RuntimeException|
|Info||May 27, 2015 12:30:49 PM||Started running the deploy step job 'hbgary-wed8 @2015-05-27 12:29:51:481-0700->hbgary-wed8 @2015-05-27 12:29:51:481-0700' on application server '218_job'(2,010,600) against target server 'sj1gwm054.corp.adobe.com'|
|Info||May 27, 2015 12:31:02 PM||The job 'hbgary-wed8 @2015-05-27 12:29:51:481-0700->hbgary-wed8 @2015-05-27 12:29:51:481-0700' has succeeded on server sj1gwm054.corp.adobe.com|
This is the command string I use to launch the script in the BlPackage, with ??ServiceName?? as a parameter of the package:
C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe -ExecutionPolicy UnRestricted -file c:\windows\temp\Set-RequiredService.ps1 -ServiceName ??ServiceName??
When I execute my script manually against these servers I can see that my script exited with 1, so I would expect that BL will see this as a terminating error.