troubleshooting Question

Status "Open" for Reg.exe Load when launched using the WshShell Exec Method

Avatar of jknuce
jknuce asked on
Shell ScriptingVB ScriptJScript
3 Comments1 Solution712 ViewsLast Modified:
I am loading a Win PE registry hive using a VBscript and the WshShell exec method. I am using the status property as a indicator to proceed. However, the status returned is always 0, even after the registry hive is loaded. Am I doing something wrong?
Option Explicit
Call ExecCmd("%comspec% /k reg.exe load HKLM\WIM_SOFTWARE ""C:\PE2-Image\mount\windows\system32\config\software""")

Sub ExecCmd(cmd)
  Dim objShell,objExec
  Set objShell = CreateObject("WScript.Shell")
  Set objExec = objShell.Exec(cmd)
	Do While objExec.Status = 0
		Wscript.echo "Process Still Open = " & objExec.Status
		wscript.Sleep 100
		Wscript.echo "Process Closed = " & objExec.Status
End Sub

Open in new window

Darren Collins
Tech Lead (Windows), Endpoint Device Management Services

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros