VBS Execution Fails using RunAsCurrentUser

(imported topic written by Matt.Johnson)

I am trying to execute a VBS script to execute as current user. Here is the current Action code:

download http://server.bigfix.com/download/bes/util/RunAsCurrentUser-2.0.3.1.exe

continue if {(size of it = 342528 AND sha1 of it = “ee47505ebfb2790b9da8a20ed70e67158e9753d0”) of file “RunAsCurrentUser-2.0.3.1.exe” of folder “__Download”}

download http://server.domain.com:52311/Uploads/043b4e80bee1b41772ff9801931901f602224a9b/BSWP.VBS.vbs.tmp

continue if {(size of it = 296 AND sha1 of it = “043b4e80bee1b41772ff9801931901f602224a9b”) of file “BSWP.VBS.vbs.tmp” of folder “__Download”}

extract BSWP.VBS.vbs.tmp

waithidden RunAsCurrentUser.exe --w cscript.exe /i __Download\BSWP.vbs /qn

Everything works fine except on the last line I get a Thread Execution failed. The files are present (both RunAsCurrentUser.exe and the BSWP.VBS) so where am I going wrong?

Thanks for any help!

(imported comment written by mbp911)

You will need make sure you indicate the path of where runascurrentuser is located. Try this.

waithidden __Download\RunAsCurrentUser.exe --w wscript “__Download\BSWP.vbs” //b

(imported comment written by Matt.Johnson)

mbp911 Thanks for the reply. I tried that line and it failed:

From the Action Log

Completed download http://software.bigfix.com/download/bes/util/RunAsCurrentUser-2.0.3.1.exe

Completed continue if {(size of it = 342528 AND sha1 of it = “ee47505ebfb2790b9da8a20ed70e67158e9753d0”) of file “RunAsCurrentUser-2.0.3.1.exe” of folder “__Download”}

Completed download http://SERVER.ent.core.DOMAIN.com:PORT/Uploads/043b4e80bee1b41772ff9801931901f602224a9b/BSWP.VBS.vbs.tmp

Completed continue if {(size of it = 296 AND sha1 of it = “043b4e80bee1b41772ff9801931901f602224a9b”) of file “BSWP.VBS.vbs.tmp” of folder “__Download”}

Completed extract BSWP.VBS.vbs.tmp

Failed wait __Download\RunAsCurrentUser.exe --w wscript __Download\BSWP.vbs //b

From the Fixlet Debugger:

STATUS: Running action…

Command succeeded (Using download manager collected file) download http://software.bigfix.com/download/bes/util/RunAsCurrentUser-2.0.3.1.exe

Command succeeded (evaluated true) continue if {(size of it = 342528 AND sha1 of it = “ee47505ebfb2790b9da8a20ed70e67158e9753d0”) of file “RunAsCurrentUser-2.0.3.1.exe” of folder “__Download”}

Command succeeded (Using download manager collected file) download http://mspm1bapps929.ent.core.medtronic.com:52311/Uploads/043b4e80bee1b41772ff9801931901f602224a9b/BSWP.VBS.vbs.tmp

Command succeeded (evaluated true) continue if {(size of it = 296 AND sha1 of it = “043b4e80bee1b41772ff9801931901f602224a9b”) of file “BSWP.VBS.vbs.tmp” of folder “__Download”}

Command succeeded extract BSWP.VBS.vbs.tmp

Command failed (Thread execution failed) waithidden __Download\RunAsCurrentUser.exe --w wscript “__Download\BSWP.vbs” //b

  • Result —

Evaluation failed!

Any ideas?

(imported comment written by SHooper)

CScript doesn’t understand the path to the VBS file. Try:

waithidden RunAsCurrentUser.exe --w cscript.exe “{pathname of client folder of current site & “__Download\BSWP.vbs”}”

If that fails, the user may not have rights to read from the BigFix directory, move the vbs file to a location the user has access to and provide the full path to the vbs file.

(imported comment written by SHooper)

Forgot a back slash: waithidden RunAsCurrentUser.exe --w cscript.exe “{pathname of client folder of current site & “__Download\BSWP.vbs”}”

(imported comment written by Matt.Johnson)

Thanks, it now replied with Relevance Clauses must be surrounded by { and } guards for that line… Yet it appears to be.

(imported comment written by SHooper)

Don’t know if you caught it, but I forgot the __Download before RunAsCurrentUser.exe, not sure if that is what is causing your error or not.

waithidden __Download\RunAsCurrentUser.exe --w cscript.exe “{pathname of client folder of current site & “__Download\BSWP.vbs”}”

You can also try:

waithidden __Download\RunAsCurrentUser.exe --w “{pathname of system folder & “\cscript.exe”}” “{pathname of client folder of current site & “__Download\BSWP.vbs”}”

(imported comment written by Matt.Johnson)

Thank both of you. I am almost there, but it keeps telling me that Relevance Clauses must be surrounded by { and } guards but they appear to be…

prefetch RunAsCurrentUser.exe sha1:ee47505ebfb2790b9da8a20ed70e67158e9753d0 size:342528 http://software.bigfix.com/download/bes/util/RunAsCurrentUser-2.0.3.1.exe

download http://mspm1bapps929.ent.core.medtronic.com:52311/Uploads/043b4e80bee1b41772ff9801931901f602224a9b/BSWP.VBS.vbs.tmp

continue if {(size of it = 296 AND sha1 of it = “043b4e80bee1b41772ff9801931901f602224a9b”) of file “BSWP.VBS.vbs.tmp” of folder “__Download”}

extract BSWP.VBS.vbs.tmp

waithidden __Download\RunAsCurrentUser.exe --w “{pathname of system folder & “\cscript.exe”}” “{pathname of client folder of current site & “__Download\BSWP.vbs”}”

(imported comment written by MattBoyd)

Looks to me like you’re trying to call “RunAsCurrentUser.exe” but it doesn’t exist because the downloaded executable is actually named “RunAsCurrentUser-2.0.3.1.exe”.

I’d suggest using this prefetch command instead, which will automatically rename it to RunAsCurrentUser.exe for you:

prefetch RunAsCurrentUser.exe sha1:ee47505ebfb2790b9da8a20ed70e67158e9753d0 size:342528 http://software.bigfix.com/download/bes/util/RunAsCurrentUser-2.0.3.1.exe

(imported comment written by SystemAdmin)

Try to copy/move the script outside “BES Client” folder and run again. The “current users” might not have the right to access “BES Client” folder if they are not in Administrator user group.

(imported comment written by TLSM)

I have the same issue as well. I had copy out the vbs script to C:\ drive also cannot run.

But if I am using QnA it running successfully just curious why at console cannot perform the action.

(imported comment written by TLSM)

Are the issue solved?

And of the code is useful?can kindly shared?

I think I also faced the same issue. That thw vbs script failed to run and hang as “Running” status.