/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


VBScript help needed

11/26/2019 465 views

I am trying to create vbscript to have the agent retrust the server and is not working not sure what I am missing.


Set WshShell = WScript.CreateObject("WScript.Shell")

runCmd = "C:\Program Files (x86)\Quest\KACE\amptoolst.exe retrust"

WshShell.Run "cmd /c " & runCmd, 0, True

0 Comments   [ + ] Show comments

Comments


All Answers

This content is currently hidden from public view.
0

Option Explicit
Dim WshShell, Path, Return

Set WshShell = WScript.CreateObject("WScript.Shell")

Path = Chr(34) & "C:\Program Files (x86)\Quest\KACE\amptools.exe" & Chr(34) & " retrust"
Return = WShShell.Run(Path,1,TRUE) '                                                                                                                                                               |

wscript.quit


Answered 12/03/2019 by: lkitsmiller
Yellow Belt

  • A while ago I found out that you can escape Quotes in VBscript by doubling them to avoid "& Chr(34) &":
    Path = """C:\Program Files (x86)\Quest\KACE\amptools.exe"" retrust"
  • When I run the script doesn't throw any errors but doesnt look like it's working. In the agent log it shows exception error " [AMPTools:AgentTools::PerformRetr] AgentTools:PerformRetrust - caught exception from boost::filesystem::remove".

    But if change the script to to runkbot it works

    Option Explicit
    Dim WshShell, Path, Return

    Set WshShell = WScript.CreateObject("WScript.Shell")

    Path = Chr(34) & "C:\Program Files (x86)\Quest\KACE\runkbot.exe" & Chr(34) & " 4 0"
    Return = WShShell.Run(Path,1,TRUE) ' |

    wscript.quit

    any ideas?

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ