Flupko Posted December 1, 2005 Share Posted December 1, 2005 Im trying to run VBS scripts in WinPE to automate the installation of W2k and W2k3.When i run a simple script that should start Notepad.exe, i get the following error message:ActiveX can't create object: "wscript.shell" Here's the script im trying to run:----------------------------------------------------------------------------------Dim server_shellDim oExecDim strExecPathstrExecpath= "c:\WINDOWS\system32\notepad.exe"Set server_shell = CreateObject("wscript.shell")Set oExec = Server_shell.exec (strExecpath)While oExec.Status = 0 WScript.Sleep 50Wendwscript.echo "Done"------------------------------------------------------------------------------------The script runs fine on XP, and I used the BuildOptionalComponents.vbs to prepare WinPE, and ran OC.bat after booting WinPE.What am i doing wrong? Thanx in advance for your help and suggestions. Link to comment Share on other sites More sharing options...
gadget Posted December 1, 2005 Share Posted December 1, 2005 I think you may need the msvbvm50 and 60 dll in i386 and registered in winpesys.inf when you compile PE. Same as what is here: http://www.msfn.org/board/index.php?showtopic=33396If i find the correct stuff i'll let you know, just cant get my hands on my own documentation. Link to comment Share on other sites More sharing options...
getwired Posted December 1, 2005 Share Posted December 1, 2005 No, VB is not a requirement for WSH to work. If it was, WSH could not run on Windows 64-bit versions, where there is no version of non .NET VB.I think something failed to register... Does it work if you change:CreateObject("wscript.shell") toWScript.CreateObject("wscript.shell")? Link to comment Share on other sites More sharing options...
Flupko Posted December 2, 2005 Author Share Posted December 2, 2005 I changed the line to WScript.CreateObject("wscript.shell")I then get the following error message:Could not locate automation class named "wscript.shell"Im new to WinPE, could someone tell me if its even possible in WinPE to use scripts like these?Must be, othwerwise WinPE would be as much as useless, but im not so sure anymore. Link to comment Share on other sites More sharing options...
mats Posted December 2, 2005 Share Posted December 2, 2005 Yes you can use vb script under pe. I have been doing it since pe 1.1First question. did you install wsh support in your pe image? ie buildoptionalcomponents /wsh and follow the instructions on screenSecond question: did you run oc.bat before starting your script. this starts the script supportThird question: Did you strip down your pe image. This can break wshshell. Link to comment Share on other sites More sharing options...
Flupko Posted December 2, 2005 Author Share Posted December 2, 2005 Yes, i used the buildoptionalcomponents.vbs, and in my second try, I installed all components.I started the OC.bat by hand, and that doesnt give me an error. I did not strip it down yet, although i was planning to.I also ran the testwsh.vbs, and that runs fine. Link to comment Share on other sites More sharing options...
Flupko Posted December 2, 2005 Author Share Posted December 2, 2005 I got it to work guys!!Mats question if I stripped it made me think. I began from scratch again, because I did inject lots of drivers and played with some files of my previous WinPE build.I have now build a new one, and that one is slightly (1MB) bigger then the previous one.Now when I run my scripts they run fine, without strange error messages.I would like to thank all of you for your help and support! Thumbs up guys, much appreciated! Link to comment Share on other sites More sharing options...
mats Posted December 2, 2005 Share Posted December 2, 2005 Guess how i found out that stripping brakes it? Link to comment Share on other sites More sharing options...
gadget Posted December 2, 2005 Share Posted December 2, 2005 Guess how i found out that stripping brakes it? Let me guess, you are now a retired stripper...I still have problems running some vb scripts cos I havent msvbvm50/60.dll registered. Might get round to changing that soon. Link to comment Share on other sites More sharing options...
mats Posted December 2, 2005 Share Posted December 2, 2005 Guess how i found out that stripping brakes it? Let me guess, you are now a retired stripper...I still have problems running some vb scripts cos I havent msvbvm50/60.dll registered. Might get round to changing that soon.Quick fix to that is to have the dll:s and the script in the same folder. Then it should work without registration. I still got the job but the included removelists are now known to be rather bad. Link to comment Share on other sites More sharing options...
getwired Posted December 3, 2005 Share Posted December 3, 2005 VB and WSH aren't interrelated at all - if you add the VB binaries to make WSH work, you'll be adding two unnecessary binaries. Odds are, if you are getting an error of some kind, then the COM object(s) you're interacting with are missing some dependency or registry entry. Link to comment Share on other sites More sharing options...
gadget Posted December 5, 2005 Share Posted December 5, 2005 my problem is not wsh. I have a program (not by me) that requires these to run. PS. How do you minimise that original command window that opens up? Link to comment Share on other sites More sharing options...
getwired Posted December 5, 2005 Share Posted December 5, 2005 my problem is not wsh. I have a program (not by me) that requires these to run. PS. How do you minimise that original command window that opens up?Ah.For the minimize, look in OC.bat. That's the file that launches OC2.bat, which is the one that runs minimized. Can't remember it off the top o'my head. Link to comment Share on other sites More sharing options...
gadget Posted December 5, 2005 Share Posted December 5, 2005 (edited) i know the /min switch but what it's the original cmd window, the 1st one that shows, the one where you type exit and it restarts pe.Gonna play with some vb6 me thinks.Found a program consolesize works great. Edited December 6, 2005 by gadget Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now