Getting INVALID AFD ERROR when running a VB script

Document ID : KB000054692
Last Modified Date : 14/02/2018
Show Technical Document Details

Description

To run a VB script you must use a wrapper.

Solution

The idea here is to run the VB script from VB and passing the script name to VB as a parm. Here's an example.

You want to run this:

    NT_JOB CYBER.NT 
    RUN CYBERUP 
    DELAYSUB 22:00 
    USER CYBRAR01 
    AGENT CYBER_NT 
    CMDNAME "D:\CYB\SCRIPT\Up.vbs"                 
    ENVAR PWD="D:\CYB\ITM\"                                   
    ARGS start  agents 
    EXITCODE 0 SUCCESS 
    ENDJOB 

To add the wrapper code the following:

    NT_JOB CYBER.NT                                          
    RUN CYBERUP                                                    
    DELAYSUB 22:00                                            
    USER CYBRAR01                                             
    AGENT CYBER_NT                                        
    CMDNAME "C:\windows\system32\wscript.exe"                
    ENVAR PWD="D:\CYB\ITM\"                                   
    ARGS "D:\CYB\SCRIPT\Up.vbs"  start  agents     
    EXITCODE 0 SUCCESS                                        
    ENDJOB    

The CMDNAME was changed to point to the location of the VB script program wscript.

The location of your script was added to the ARGS so it would be passed as a parm.