Help - Search - Members - Calendar
Full Version: Running ImageX from VBScript
MSFN Forums > Unattended Windows Discussion & Support > Windows PE

   
Google Internet Forums Unattended CD/DVD Guide
ryarnell
Hello,
I am having some trouble running ImageX from a vbScript in VistaPE.
Here is what the script looks like and the error it throws.

Dim Shell
Dim myResult

Set shell = CreateObject("WScript.Shell")
myResult = shell.Run("imagex.exe", 1, True)

When I run this is get:
The operation was cancelled by the user.

Here is what I have done / tried.

If I replace imagex with notepad, notepad comes up just fine so, I know the script is OK.
I have imagex.exe in the same directory as the script. I have even added the path like this "c:\test\imagex.exe"
still the same error.
I even copied imagex.exe over to the system32 directory so it would be in the path and still get the same error.

If I type imagex.exe at the prompt it gives the normal help output to the screen you would expect to see.
I can also type out the whole line with /apply and it works from the command line.
It just doesn't work inside the script.

Has anyone else ever seen this or know how to make this work.

Thanks a bunch.

crahak
It might have something to do with VistaPE, because it runs just fine as-is on Vista, no error messages at all.
Br4tt3
Hi,

First of all, like u say... if u try to run notepad.exe it works right? well, as long as u execute ur .vbs file with cscript.exe (default is wscript.exe) from within an existing cmd console, this should also work.... if u try to execute a CLI command from an vbscript which in turn is kicked by wscript.exe, there should only be quick flicker on the screen... instead, open up cmd.exe, type <cscript.exe my_vbs_file.vbs>, execute and u should see the /INFO list poping up....

CODE
Option Explicit

WScript.Echo ExecAppRM("imagex.exe /info D:\Distribution\Captures\WINVISTA_X64_ENT.wim")

Function ExecAppRM(pstrCommand)
  Dim oRun
  Dim n
  Dim WshShell
  Dim strResult

  Set WshShell = WScript.CreateObject("WScript.Shell")    
  
  n=0
  Set oRun=WshShell.Exec(pstrCommand)        
  ExecAppRM = oRun.StdOut.ReadAll

End Function


Hope it does it for you....
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.