Kaseya Community

VBS does not start from agent procedure

  • Hello,


    I have a problem with starting a .vbs with an agent procedure. WSCRIPT.EXE does show up in the taskmanager but does not start the script.

    If i start the script manual i get the results i want.
    Even when i start a .bat file the procedure wont start the file.


    Part of my procedure:

    - <Statement description="Write the selected file to the machine at the path specified - full path required." name="WriteFile" continueOnFail="false">
      <Parameter xsi:type="StringParameter" name="Path" value="#AgentTemp#\CheckUpdates\updates.vbs" />
      <Parameter xsi:type="StringParameter" name="ManagedFile" value="VSASharedFiles\updates.vbs" />
      <Parameter xsi:type="BooleanParameter" name="DeleteAfter" value="False" />
    - <Statement description="Execute the specified file - full path to file required." name="ExecuteFile" continueOnFail="false">
      <Parameter xsi:type="StringParameter" name="Path" value="%systemroot%\system32\wscript.exe" />
      <Parameter xsi:type="StringParameter" name="Arguments" value="#AgentTemp#\CheckUpdates\updates.vbs" />
      <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
      <Parameter xsi:type="BooleanParameter" name="WaitComplete" value="True" />
    Hope someone can help me
    Regards Sander

    [edited by: ICT Spirit at 2:57 AM (GMT -7) on 5-25-2011] Extra info
  • using the execute file command; I directly call the full path of my update.vbs.

    This works perfectly.

    If that doesnt work running from a batch might work?

    cmd /c runs command prompt hidden.

  • Hello Krijn,

    I made a command that only runs the batch file but doesnt start as well.

  • Execute the batch file. Make sure to choose coreect option at 'Run As' Logged on user / system account.

    What your trying to do is run a batch file from a .vbs script?

    Please help me understand the purpose

  • if you want to run a hidden batch, i can write you an .exe file wich does the job.

    Let me know!

  • Let me explain:

    I made a vbscript that looks for available updates on a server, counts them and put that number into a textfile.

    The textfile will be created with the following command: Set objFile = objFSO.CreateTextFile("file.txt")

    When i start the .vbs with dubbleclick the file creates the txt but when i use the commandline i get a permission denied.

    For now i solved the problem by giving the whole path Set objFile = objFSO.CreateTextFile("c:\dir\dir\file.txt")

    But that is not the perfect situation

  • thats weird. Seems like a VB problem.

    Maybe create sthe same script in c#?

  • By the way, did you try using the 'Use credential' in the agent procedure?

    Might work.


  • Ah I think I understand, when you run the script it creates the file, and the "permission denied" error you are getting is because you did not specify the path so the script will try and create the file in the home path of the user account you are using.

    You need to pass variables to your VB script to specify the path and file name so that the VB script can create the file in a path that it has permission to access such as the AgentTempDir (e.g.: c:\kworking) path. If you do it this way then you can specify the path and file name in your Kaseya script.