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
Answers (1)
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