4 Replies Latest reply on Feb 23, 2013 7:31 AM by Jim Wilson

    type-3 nsh job failing on the windows target

    Shankar Masekar

      Hi All,

       

      I’m trying a run type-3 nsh script job on the windows target server ,which contains .bat script that will call other two VB scripts hosted on the same server & run them against few exchange servers to reboot them after patching & then notifies the reboot status to specified email address .

       

      There is another txt file containing the list of exchange servers placed on the same target server ,which will be called by first VB script (servereboot1.vbs) to get the list of servers that needs to be rebooted .

       

      I’m able to successfully run the .bat script manually on the target server, but when I ran the same script via BSA nsh job, its failing with below error that corresponds to VB script runtime error..

       

      Here is the NSH script job log….

       

      Info  Dec 11, 2012 10:56:11 AM      Exit Code 0

      Error Dec 11, 2012 10:56:10 AM      D:\Scripts\SystemsReboot\ServerReboot1.vbs(31, 3) Microsoft VBScript runtime error: Subscript out of range: '[number: 0]'

      Info  Dec 11, 2012 10:55:59 AM      Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

      Info  Dec 11, 2012 10:55:59 AM      Microsoft (R) Windows Script Host Version 5.6

      Info  Dec 11, 2012 10:55:58 AM      D:\Scripts\SystemsReboot>ServerReboot1.vbs /ServerType:EMAIL-DEV

      Info  Dec 11, 2012 10:55:58 AM      The default script host is now set to "cscript.exe".

      Info  Dec 11, 2012 10:55:58 AM      Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

      Info  Dec 11, 2012 10:55:58 AM      Microsoft (R) Windows Script Host Version 5.6

      Info  Dec 11, 2012 10:55:58 AM      D:\Scripts\SystemsReboot>cscript //H:cscript

      Info  Dec 11, 2012 10:55:58 AM      D:\Scripts\SystemsReboot>cd \Scripts\SystemsReboot

      Info  Dec 11, 2012 10:55:58 AM      D:\Scripts\SystemsReboot>D:

      Info  Dec 11, 2012 10:55:58 AM      D:\Scripts\SystemsReboot>ServerReboot-EMAIL-DEV.bat

      Info  Dec 11, 2012 10:55:58 AM      D:\Scripts\SystemsReboot>cd \Scripts\SystemsReboot

      Info  Dec 11, 2012 10:55:58 AM      c:\>D:

       

      Here is the nsh script..

      D:

      cd \Scripts\SystemsReboot

      ServerReboot-EMAIL-DEV.bat

       

       

      I’m attaching the actual batch script & other 2 VB scripts for your reference.

       

      Can someone help me understand, why the NSH job is failing with VB script runtime error & help me get it fix.

       

      Thanks,

      Shankar 

        • 1. Re: type-3 nsh job failing on the windows target

          I only took a brief look.  But, the error is a Microsoft error suggesting and array out of bounds error at the below line of your ServerReboot1.vbs script which is like 31 noted. You may want to see what input this relies on and put in additional logging/code to see what isn’t happening that may cause nothing to be at the 0 index of the TxtList variable.

           

                                          strServer = UCase(TxtList(0))

          • 2. Re: type-3 nsh job failing on the windows target
            Shankar Masekar

            Thanks Tim for the reply.

             

            I have noted that & also informed customer to have a look into the serverReboot1.vbs script , but the problem is the script runs absolutely fine when you run it on the target server manually (double click batch script...that’s it).

             

            Hence, I was wondering what’s causing to fail the same scrit when it is being run from the NSH job.

             

            Can someone help me troubleshot this ?

             

            Regards,

            Shankar

            • 3. Re: type-3 nsh job failing on the windows target

              The steps I suggested are to help troubleshoot.

               

              This may show that the commandline argument isn't getting passed in (I assume this isn't the problem since the the argument passed is what allows it to get into the IF clause the error is happening at) or that the script is being run in a location that isn't relative to the csv file being used or something else all together.

               

              Knowing what isn't happening in the script to allow it to function appropriately is key to determining what BSA is potentially doing wrong.

              • 4. Re: type-3 nsh job failing on the windows target
                Jim Wilson

                Hi Shankar,

                 

                Did this get resolved?

                If so, please can you update the discussion thread with details so that is can be marked as answered.

                 

                Thanks & Regards,

                Jim (Forum Manager/Facilitator)