Jump to content

Scripting and Windows PE


EvilGuinness

Recommended Posts

Hello,

I'd like to run some scripts written in vbs under Windows PE....I followed a small tutorial, but I have still problems. I've all the files I need, I use regsrv32 to register the dll/ocx files, but...I don't know how to modify the registry keys.

Cscript and wscript are recognized, but I have an error message saying that "there isn't script engine for ".vbs" files".

Anyone to help? Thanks!

PS : I work on the "official" Microsoft Windows PE.

Link to comment
Share on other sites


Oh, it seems I forgot something...I don't find anything about things like this in my docs.

I just have these instructions :

"

1. Copy the contents of the WINPE folder from the Tools CD to your WinPE source folder, say c:\WINPE.

2. Copy the following DLL’s and OCX files from the Windows XP HOME/ PRO cd into your WINPE folder.

vbscript.dll, scrrun.dll, cscript.exe, wscript.exe, wshext.dll, wshom.ocx, dispex.dll, jscript.dll.

3. For localized support, I assume that wshext.dll is the only localized file. It also helps to use the localized versions for all these files. (I should be trying this later).

4. Modify the extra.inf file in the WINPE folder, in order to copy these extra files into the WINPE CD. (for detailed information on the extra.inf file format, please refer to the customizing WINPE whitepaper.

[ExtraFiles.x86]

……

…..

vbscript.dll=1,,,,,,,,0,0,,1,2

scrrun.dll=1,,,,,,,,0,0,,1,2

cscript.exe=1,,,,,,,,0,0,,1,2

wscript.exe=1,,,,,,,,0,0,,1,2

wshext.dll=1,,,,,,,,0,0,,1,2

wshom.ocx=1,,,,,,,,0,0,,1,2

dispex.dll=1,,,,,,,,0,0,,1,2

jscript.dll=1,,,,,,,,0,0,,1,2

<Please note that I have also copied over my scripting files>

recscript.vbs=1,,,,,,,,0,0,,1,2

script.vbs=1,,,,,,,,0,0,,1,2

4. Modify the config.inf to make sure that the appropriate registry keys are populated. (All the INF files are in the attached Zip File.) Make sure to copy the script.inf and scriptkey.inf to the c:\WINPE folder.

; Please note that I have added script.inf

;

[Add Registry New]

software = .\hivesft.inf,AddReg,.\hivecls.inf,AddReg,.\script.inf,AddReg

default = .\hivedef.inf,AddReg

;

; Please note that I have added scriptkey.inf

;

[Add Registry Existing]

setupreg.hiv = .\winpesys.inf,AddReg

software = .\winpesft.inf,AddReg,.\scriptkey.inf,AddReg

default = .\winpedef.inf,AddReg

5. Modify the startnet.cmd to have the following entries. These are needed in order to register the Scripting Dll’s.

REM If there is no networking support, you can skip the netcfgx.dll

regsvr32 /s netcfgx.dll

regsvr32 /s dispex.dll

regsvr32 /s jscript.dll

regsvr32 /s scrrun.dll

regsvr32 /s vbscript.dll

regsvr32 /s wshext.dll

regsvr32 /s wshom.ocx

REM I’m launching the CMDLINE scripting exe.

cscript.exe recscript.vbs

"

I followed these steps, excepting the things related to .inf files....I think there's something wrong, because there is no reference to the "script engine".

Could you say me where I can find doc about the script engine, please? I really don't know where I can search for this. I'm only a beginner in things like that. I've found the solution for PE build with BartPE, but not with the official release.

Thanks!

Link to comment
Share on other sites

Ok, I've found the script engine on the MS website...I understand a little better the problem.

edit : hum, it seems this script engine contains exactly the same dll's I previously installed on Win PE...

Now I have an other problem (it refuses to install) but I think it would be off-topic :)

Thanks a lot!

Link to comment
Share on other sites

Ok, I've found the script engine on the MS website...I understand a little better the problem.

edit : hum, it seems this script engine contains exactly the same dll's I previously installed on Win PE...

Now I have an other problem (it refuses to install) but I think it would be off-topic :)

Thanks a lot!

Sorry man, looks like it is time start from scratch.

Link to comment
Share on other sites

I posted all around the net (hum, not "all around" but I posted some questions on several websites), but I don't have any answer....I'll try to post on the Microsoft newgroups in English : my posts on the French newsgroups don't give me anything.

edit : I forgot to say that my PE boots from a RIS server...I don't know if it changes anything.

Link to comment
Share on other sites

Oh, that's strange! It works now....but I don't know why :)

I installed the dll files just as said in my docs. It didn't work. I downloaded the French version of the script engine (installation of my dll files, but in a different way...). I had some errors...I tried to modify some files, but it didn't change anything.

So I dowloaded the English version of the script engine....and it works. That's strange : I don't have any error whith it, I don't understand. My server is a French version of Win Server 2003, and it works only with the English script engine....it's the same for my PE.

Well, I'm very happy to see it works, I've spent lots of time on this.

Thanks everybody for the help!

Link to comment
Share on other sites

I posted on the Microsoft newsgroups...and I have the solution. Here is the answer :

Hi Romain:

Thanks for your posting.

If you have the SP1 version of the OPK, then adding scripting support is

much simpler.

On the OPKTools (WinPE) CD, there is a VBS script that can be run on the

machine you use to create your winpe images.

BUILDOPTIONALCOMPONENTS.VBS.

You can use it to add Scripting support, database (ADO) connectivity

support and HTA (HTML for applications) support.

The syntax is:

BUILDOPTIONALCOMPONENTS.VBS /s:(OS_CDROM) /d:(destination_dir) /WSH (or

/ADO or /HTA)

/s: points to the source drive letter where the OS CD rom is located (XP

Pro SP1 OS or better)

/d: points to the destination "root" destination directory where the winpe

image is stored (e.g. the same folder name as used with MKIMG)

There is a batch file that needs to be added to

(winpe_image)\i386\system32\STARTNET.CMD. It's called OC.BAT, so you can

add using:

STARTNET.CMD

---------------------------

CALL OC.BAT <---- registers dlls for scripting host

(etc)

Regards,

Todd~SBST

That was easy....but I didn't fond any doc about this. Maybe I searched in the wrong places.

Edit : it works perfectly...I'm waiting for the next problem :)

Edited by EvilGuinness
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...