2 Replies Latest reply on Jun 5, 2015 1:46 PM by Russ Todd

    powershell blpackage error handling

      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?




      The Error:

      WarningMay 27, 2015 12:30:53 PM [stderr: 2]Unable to start Service HBG_DDNA
      WarningMay 27, 2015 12:30:53 PM    + CategoryInfo          : OperationStopped: (Unable to start Service HBG_D
      WarningMay 27, 2015 12:30:53 PM    + FullyQualifiedErrorId : Unable to start Service HBG_DDNA
      WarningMay 27, 2015 12:30:53 PM+         Throw <<<<  "Unable to start Service " +$ServiceName
      WarningMay 27, 2015 12:30:53 PMAt C:\windows\temp\Set-RequiredService.ps1:43 char:8
      InfoMay 27, 2015 12:30:49 PMDeploy 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
      WarningMay 27, 2015 12:30:53 PM   DNA:String) [], RuntimeException
      InfoMay 27, 2015 12:30:49 PMStarted 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'
      InfoMay 27, 2015 12:31:02 PMThe 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.