Software Distribution: run vbs file on client

(imported topic written by Peihua)

Hi,

I’ve got a Microsoft Office removal ultility script in vbs and wanted to make use of software distribution to push it to my client. the file was named “RemoveOffice2010Utility.vbs”.

When i create a task. I added a argument behind the command “RemoveOffice2010Ultility.vbs ALL”.

After the task run. the result show completed but it seems like script does not run before. I have tested working by using cmd to run the command line “RemoveOffice2010Ultility.vbs ALL”

When i used Fixletdebugger to run the action. An error show: VBScript runtime error: Variable is undefined: “ERROR_ELEVATION_FAILED”

Does anyone have any experience with this before?

(imported comment written by dominic.otoole)

An example from a working fixlet:

waithidden cmd.exe /C cscript.exe /B /Nologo “path to VBS file” “parameter1”

(imported comment written by Peihua)

Hi Dominic,

Thank for your tips.

however, i am still getting the VBScript runtime error: Variable is undefined. “ERROR_ELEVATION_FAILED”

(imported comment written by JasonWalker)

It sounds like it’s your VBScript itself that’s giving an error. Have you run it by itself on a command line using “cscript.exe”?

One thing to note, since the BES client itself is 32-bit, by default it would run the 32-bit version of cscript.exe from \windows\syswow64. You may need to configure your Action to use the 64-bit cscript.exe by including

action uses wow64redirection false

somewhere in your action script before you execute cscript.

(imported comment written by Peihua)

Hi Jason,

I did tried by double click on the vbscript file and it is running well.

but when it run using BES or create another batch file to run the vbscript, it has error of error_elevation_failed.

(imported comment written by JasonWalker)

If it’s not running from inside a batch file, that pretty clearly seems like a problem with the VBScript itself. You’ll need to open an Elevated Command Prompt, and have the script execute via the command line

cscript.exe //nologo myscriptfile.vbs

and have that run correctly before you’d have any hope of getting it to run from the BES client. error_elevation_failed is not a familiar VBScript error, it’s probably a custom error handler that’s part of the script itself.

If I had to guess, I’d say the script probably has logic to trigger a UAC elevation prompt when you run it. When you double-click it do you get a prompt to run the script as Administrator? It may be the case that when you run it on a command line with no GUI, it’s not able to pop-up the UAC prompt and thus it just fails.

Running it from an Elevated Command Prompt may help, unless there’s an error in the script where it does not check whether it’s already elevated before trying to prompt for elevated credentials.

In any case, troubleshoot this as a VBScript problem until you can get it to run from an Elevated Command Prompt. Don’t try running it through BigFix until you’re sure it works (running under BigFix just makes it harder to troubleshoot).

If anyone comes across this in the future while trying to run the officescrubXXX.vbs scripts from bigfix, you do need to force the 64 bit cscript, and the code is

action uses wow64 redirection false

With a space between wow64 and redirection.

And here I am over 2 years after your post attempting to run officescrub.vbs and it wasn’t working…google brought me to right spot. Thanks!

1 Like