/build/static/layout/Breadcrumb_cap_w.png

VBScript help needed

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

Answers (1)

Posted by: lkitsmiller 5 years ago
Yellow Belt
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



Comments:
  • 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" - chrpetri 5 years ago
  • 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? - bozadmin 5 years ago
 
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