I use the following script to make sure the error is not given while running a SCCM program. I am not able to use in a 64 bit machine. test.cmd has the command to execute the program.Can someone help ?

Dim WshShell, UIv
Set WshShell = Wscript.CreateObject("Wscript.Shell")
On Error Resume Next


UIv = "test.cmd"


WshShell.Run UIv,1,True


If (Err.Number = 0) OR (Err.Number = 1605) Then
  WScript.Quit(0)
End If
Set WshShell = Nothing
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

1
Hi ninjaguy,

it´s working but better change the object declaration to

Set WshShell = CreateObject("Wscript.Shell")

but why do you put the command to execute the program in a command file and not in this vbs too.

WshShell.Run "%COMSPEC% /k ipconfig /all", 0, True
Answered 03/04/2015 by: aragorn.2003
Red Belt

Please log in to comment

Answers

0

I can't be sure but this might be for the same reason which causes scripts to fail to run "inside" MSIs, viz. that the environment doesn't "know" what Windows Scripting Host is. Try changing this:

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

to this:

Set WshShell = CreateObject("Wscript.Shell")

For forum etiquette, please apply the 'Code' style to your code fragment, as I have done here.

Answered 03/04/2015 by: VBScab
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity