Jump to content

VBScript/JScript in PE 2.0 not working


TofuBug

Recommended Posts

Just spent the last few hours sloshing through the message boards here on PE and i have to say i am very impressed with the collection of knowledge.

however i can't seem to find the answer to my question so it's post time.

a little back ground to help you understand where i am currently:

my company is currently on a 95/5% XP pro SP2 /windows 2000 sp4 norton ghost based image/reimage system.

our imaging/reimaging technicians use a VERY VERY limited windows PE (1.6 i believe) boot cd that maps 3 shared network resources and launches a batch file from one of the lan resources. primitive but works (up until a few months ago that is)

Now I Develop the distribution scripts and programs we use to distribute software to our computers (mostly vb, hta, js, wmi, access since it's all interpreted code and hence no compiled code review needed)

usually i rarely deal with the imaging guys. however i'm in the production push phase of a massive laptop hard drive encryption program the corporation has mandated on all laptops, slick little deal small package encrypts the entire drive boot sector and all, however it throws a huge wrench in our reimage process.

basically here's our normal "recovery" process

boot pc up with pe cd->connect to data store lan share->use ghost with high compression to image the entire drive->apply a base image onto the computer->use ghost explorer and pull customers personal data over (2-4 hours depending on the system)

with encryption in place however we have 3 options: bit for bit RAW ghost image, decompress the drive (12-50+ hours), or run a pe based access utility which basically unlocks the drive in about 30 seconds. (obviously you can guess which one we're going to use)

all this means that we need to update our pe boot cd, and suddenly since i'm the executioner with the black hood and axe so to speak dropping encryption on everyones head it now falls on me to redo the pe boot cd. i'm trying to overcome the following hurdles

1. until a week ago i have never even touched PE (heard of it that's it)

2. spoke to the person who created the original cd, he had no clue how any of it worked (go canned solutions!)

3. i'm on a serious time table to have this up and running asap FQ

here's some things i have gotten to work:

1. downloaded WAIK and BDD 2007 (so far i've had fairly good luck creating test cd's that partially work)

2. loaded our collection of nic driver's and successfully connected various models of our computers to out lan

3. load WMI, HTA, VBS, JS, etc

now that i've put you all to sleep here's my pressing problem at the moment.

HTA works just fine but none of the JS or VBS scripts work at all

WMI works through the wmi explorer

.vbs file error out with a "There is no script engine for file extension .vbs" message

i'm using the pe 2.0 tools and i've followed the directions for peimag /install= to install every one of those add ons and they all list as installed however vbs files do not work at all.

here's where i really get confused everyone keeps saying to run the BuildOptionalComponents.vbs which would be all fine and dandy if i could find it anywhere with WAIK or BDD 2007 (unless i am totaly blind which is possible).

could someone clear up this for me basically 2 things

has BuildOptionalComponents.vbs been replaced by some other registration mechanism in pe 2.0

if so how do you make sure the components (hta,wmi,vbs,mdac, etc work in pe 2.0

Thanks so much for everyones time,

Cheers,

Ryan Strope

Distributed Services

(Software package development/testing)

Lockheed Martin Systems Integration Owego

(Cyber City Computers)

ryan.strope@lmco.com

Quid quid latine dictum sit, altum videtur

Link to comment
Share on other sites


Yes, the new BuildOptionalComponents.vbs, is now

here are the packages that I install to get HTA and scripting installed:

%PETOOLS%\peimg.exe /install=WinPE-HTA-Package %isosource%\Mount\Windows

%PETOOLS%\peimg.exe /install=WinPE-WMI-Package %isosource%\Mount\Windows

%PETOOLS%\peimg.exe /install=WinPE-Scripting-Package %isosource%\Mount\Windows

%PETOOLS%\peimg.exe /install=WinPE-XML-Package %isosource%\Mount\Windows

%PETOOLS%\peimg.exe /install=WinPE-MDAC-Package %isosource%\Mount\Windows

only "WinPE-Scripting-Package" should be needed to handle your VBS files.

Read up on "peimg" in the help files, it will answer your questions.

Link to comment
Share on other sites

Yes, the new BuildOptionalComponents.vbs, is now

here are the packages that I install to get HTA and scripting installed:

%PETOOLS%\peimg.exe /install=WinPE-HTA-Package %isosource%\Mount\Windows

%PETOOLS%\peimg.exe /install=WinPE-WMI-Package %isosource%\Mount\Windows

%PETOOLS%\peimg.exe /install=WinPE-Scripting-Package %isosource%\Mount\Windows

%PETOOLS%\peimg.exe /install=WinPE-XML-Package %isosource%\Mount\Windows

%PETOOLS%\peimg.exe /install=WinPE-MDAC-Package %isosource%\Mount\Windows

only "WinPE-Scripting-Package" should be needed to handle your VBS files.

Read up on "peimg" in the help files, it will answer your questions.

I did install every last one of those i diligently followed microsoft's walkthrough right in the chm to create a custom boot pe cd multiple times (i even ran through it copy and pasting the "recomended" strings into the pe tools command prompt got no errors, but scripting just does not want to work)

i've been through the help file many many times already (it's usually where i learn most about a new tool) but microsoft's explanaitions and examples alot of times are very vague. which is why i like forums like this a little clairity from others helps alot.

Cheers,

Ryan Strope

Distributed Services

(Software package development/testing)

Lockheed Martin Systems Integration Owego

(Cyber City Computers)

ryan.strope@lmco.com

Quid quid latine dictum sit, altum videtur

Link to comment
Share on other sites

Yes, the new BuildOptionalComponents.vbs, is now

here are the packages that I install to get HTA and scripting installed:

%PETOOLS%\peimg.exe /install=WinPE-HTA-Package %isosource%\Mount\Windows

%PETOOLS%\peimg.exe /install=WinPE-WMI-Package %isosource%\Mount\Windows

%PETOOLS%\peimg.exe /install=WinPE-Scripting-Package %isosource%\Mount\Windows

%PETOOLS%\peimg.exe /install=WinPE-XML-Package %isosource%\Mount\Windows

%PETOOLS%\peimg.exe /install=WinPE-MDAC-Package %isosource%\Mount\Windows

only "WinPE-Scripting-Package" should be needed to handle your VBS files.

Read up on "peimg" in the help files, it will answer your questions.

I did install every last one of those i diligently followed microsoft's walkthrough right in the chm to create a custom boot pe cd multiple times (i even ran through it copy and pasting the "recomended" strings into the pe tools command prompt got no errors, but scripting just does not want to work)

i've been through the help file many many times already (it's usually where i learn most about a new tool) but microsoft's explanaitions and examples alot of times are very vague. which is why i like forums like this a little clairity from others helps alot.

Cheers,

Ryan Strope

Distributed Services

(Software package development/testing)

Lockheed Martin Systems Integration Owego

(Cyber City Computers)

ryan.strope@lmco.com

Quid quid latine dictum sit, altum videtur

Link to comment
Share on other sites

what happens when you run:

wscript.exe script.vbs

It gives me the "There is no script engine for file extension .vbs" message

it just seems to me that there's a step missing in microsofts procedure to enable scripting in pe 2.0

Link to comment
Share on other sites

what happens when you run:

wscript.exe script.vbs

It gives me the "There is no script engine for file extension .vbs" message

it just seems to me that there's a step missing in microsofts procedure to enable scripting in pe 2.0

Same thing with CScript.exe script.vbs by the way

Link to comment
Share on other sites

Post the steps your going through to build your WinPE2 WIM. I know it works, because mine is using HTA's with built in WMI calls, calling VBS scripts, doing XML parsing, etc.

Step 1: Set up a Windows PE Build EnvironmentIn this step, you will create a required directory structure that supports building a Windows PE image.

On your technician computer, click Start, point to All Programs, point to Windows OPK or Windows AIK, and then click Windows PE Tools Command Prompt.

The menu shortcut opens a Command Prompt window and automatically sets environment variables to point to all the necessary tools. By default, all tools are installed at C:\Program Files\<version>\Tools, where <version> can be Windows OPK or Windows AIK.

At the command prompt, run the Copype.cmd script. The script requires two arguments: hardware architecture and destination location. For example,

copype.cmd <arch> <destination>

Where <arch> can be x86, amd64, or ia64 and <destination> is a path to the local directory. For example,

copype.cmd x86 c:\winpe_x86

The script creates the following directory structure and copies all the necessary files for that architecture. For example,

\winpe_x86

\winpe_x86\ISO

\winpe_x86\mount

Step 2: Mount the Base Windows PE ImageIn this step, you will mount the base image to a local directory so that you can add or remove packages.

At the command prompt, mount the base Windows PE image (Winpe.wim) to the \mount directory by using ImageX. For example,

imagex /mountrw c:\winpe_x86\winpe.wim 1 c:\winpe_x86\mount

Step 3: Add Additional PackagesBy using the Peimg tool, you will install Windows features by using the /install option. Windows features are included with the base image (Winpe.wim) but are not installed. You can also import packages and add drivers and language packs. For more information, see Windows PE Customization How-To Topics.

Add a Windows feature to the base image by using the peimg /install command. For example,

peimg /install=<pkg> c:\winpe_x86\mount\Windows

where <pkg> denotes the package name. A list of available packages and their names can be obtained by using the /list command. Wildcards can be used when specifying a package name. Any packages with matching names will be installed. For example,

peimg /install=WinPE-HTA-Package c:\winpe_x86\mount\Windows

-OR-

peimg /install=*HTA* c:\winpe_x86\mount\Windows

Where wildcards denote any package with HTA in the package name.

Windows PE 2.0 provides the following Windows features referred to as packages:

Package Name Description

WinPE-HTA-Package

HTML application support

WinPE-MDAC-Package

Microsoft Data Access Component support

WinPE-Scripting-Package

Windows Script Host support

WinPE-SRT-Package

Windows Recovery Environment component

WinPE-XML-Package

Microsoft XML (MSXML) parser support

Repeat step 1 for each package.

Verify that the packages were installed by using the peimg /list command to view all packages in the current image. For example,

peimg /list c:\winpe_x86\mount\Windows

In the INS column, (+) denotes installed packages and (-) denotes not installed.

Step 4: Add Additional Customizations (Optional)This step is optional but recommended. You can add applications and scripts to your Windows PE image that you might need while working in Windows PE. The following is a list of common tools to include in your Windows PE image:

ImageX

A command-line tool for capturing and applying images during deployment scenarios. For example, at a command prompt,

copy “c:\program files\<version>\Tools\x86\imagex.exe” c:\winpe_x86\iso\

Package Manager (Pkgmgr.exe)

A tool for servicing Windows image (.wim) files offline. You must copy the entire \Servicing folder and MSXML6 binaries. Offline servicing requires ImageX. For example,

xcopy “c:\program files\<version>\Tools\<architecture>\Servicing” c:\winpe_x86\iso\Servicing /s

copy %windir%\system32\msxml6*.dll c:\winpe_x86\iso\Servicing

Where <version> can be Windows OPK or Windows AIK and <architecture> can be x86, amd64, or ia64. In both previous examples, the tools are not loaded into memory during a Windows PE RAM boot. The media must be available to access the tools.

To load the tools into memory along with Windows PE, copy the source files into the mounted \Windows directory. For example,

c:\winpe_x86\mount\Windows

Important:

Adding files to the \Windows directory will increase the size of your Windows PE RAM image. Make sure your computer has sufficient memory to boot Windows PE and run various applications.

Step 5: Prepare the ImageIn this step, you will prepare the image by using the peimg /prep command. This operation removes any non-installed packages from the final image. This operation reduces the overall image size. For example,

peimg /prep c:\winpe_x86\mount\Windows

The /prep option cannot be reverted, and after the /prep option is run, the /install, /uninstall, /import, and /list options will not function, while the /lang and /inf options will continue to function. The Peimg tool prompts you to confirm the command. To suppress this prompt for scripting, add the /f option.

Step 6: Commit Changes to the ImageIn this step, you commit the changes to the original image file (Winpe.wim) by using the ImageX /unmount option with the /commit option. For example,

imagex /unmount c:\winpe_x86\mount /commit

Step 7: Replace the Default Boot.wim FileIn this step, you replace the default Boot.wim in the \ISO directory with your new custom image. The image must be called Boot.wim. For example,

copy c:\winpe_x86\winpe.wim c:\winpe_x86\ISO\sources\boot.wim

Next StepYou now have a custom Windows PE RAM disk image that you can place on bootable media, like a CD-ROM or UFD.

To create a bootable CD-ROM

On your technician computer, at a command prompt, create an .iso file by using Oscdimg. For example,

oscdimg -n -bc:\winpe_x86\etfsboot.com c:\winpe_x86\ISO c:\winpe_x86\winpe_x86.iso

that's it straight out of the chm i even coppied and pasted the lines into the pe tools command prompt once or twice through trying to get this to work.

i get zero errors when going through the procedure, once i go to use the cd though no scripting.

Link to comment
Share on other sites

I know this script works to create a working WinPE2 ISO that will run VBS script. I just tested it in VMWare, booted up, mapped a drive, and ran a couple of vbs scripts.

rem ***************** Set your own paths if they are different  ***********************
set PETOOLS=C:\Program Files\Windows AIK\Tools\PETools
set IMAGEX=C:\Program Files\Windows AIK\Tools\x86
set ISOSOURCE=C:\winpe_2x86
set ISONAME=WINPEv2.ISO
%COMSPEC% /c "%PETOOLS%\copype.cmd" x86 %ISOSOURCE%
"%IMAGEX%\imagex.exe" /mountrw %ISOSOURCE%\winpe.wim 1 %ISOSOURCE%\mount
xcopy "%ISOSOURCE%\mount\Windows\System32\Boot\*.*" %ISOSOURCE%\mount\Windows\System32\*.* /e /y
rem ***************** Installing packages ***********************
"%PETOOLS%\peimg.exe" /install=WinPE-HTA-Package %ISOSOURCE%\Mount\Windows
"%PETOOLS%\peimg.exe" /install=WinPE-WMI-Package %ISOSOURCE%\Mount\Windows
"%PETOOLS%\peimg.exe" /install=WinPE-Scripting-Package %ISOSOURCE%\Mount\Windows
"%PETOOLS%\peimg.exe" /install=WinPE-XML-Package %ISOSOURCE%\Mount\Windows
"%PETOOLS%\peimg.exe" /install=WinPE-MDAC-Package %ISOSOURCE%\Mount\Windows
rem ***************** This is were you would install drivers and copy over files if needed ***********************
rem "%PETOOLS%\peimg.exe" /inf:{FULL PATH}\{DRIVER.INF} %ISOSOURCE%\Mount\Windows
rem ***************** Finalizing the WIM ***********************
"%PETOOLS%\peimg.exe" /prep /f %ISOSOURCE%\Mount\Windows
rem ***************** Deleting the ISO boot WIM so we can use ours ***********************
del %ISOSOURCE%\ISO\sources\boot.wim
rem ***************** Creating a compressed WIM ***********************
"%IMAGEX%\imagex.exe" /boot /compress maximum /capture %ISOSOURCE%\Mount %ISOSOURCE%\ISO\sources\boot.wim "WinPE2"
rem ***************** Closing the WIM ***********************
"%IMAGEX%\imagex.exe" /unmount %ISOSOURCE%\mount /commit
rem ***************** Building ISO ***********************
"%PETOOLS%\oscdimg.exe" -n -b%ISOSOURCE%\etfsboot.com %ISOSOURCE%\ISO %ISOSOURCE%\%ISONAME%

try this out, and tell me how it works.

Link to comment
Share on other sites

I know this script works to create a working WinPE2 ISO that will run VBS script. I just tested it in VMWare, booted up, mapped a drive, and ran a couple of vbs scripts.

rem ***************** Set your own paths if they are different  ***********************
set PETOOLS=C:\Program Files\Windows AIK\Tools\PETools
set IMAGEX=C:\Program Files\Windows AIK\Tools\x86
set ISOSOURCE=C:\winpe_2x86
set ISONAME=WINPEv2.ISO
%COMSPEC% /c "%PETOOLS%\copype.cmd" x86 %ISOSOURCE%
"%IMAGEX%\imagex.exe" /mountrw %ISOSOURCE%\winpe.wim 1 %ISOSOURCE%\mount
xcopy "%ISOSOURCE%\mount\Windows\System32\Boot\*.*" %ISOSOURCE%\mount\Windows\System32\*.* /e /y
rem ***************** Installing packages ***********************
"%PETOOLS%\peimg.exe" /install=WinPE-HTA-Package %ISOSOURCE%\Mount\Windows
"%PETOOLS%\peimg.exe" /install=WinPE-WMI-Package %ISOSOURCE%\Mount\Windows
"%PETOOLS%\peimg.exe" /install=WinPE-Scripting-Package %ISOSOURCE%\Mount\Windows
"%PETOOLS%\peimg.exe" /install=WinPE-XML-Package %ISOSOURCE%\Mount\Windows
"%PETOOLS%\peimg.exe" /install=WinPE-MDAC-Package %ISOSOURCE%\Mount\Windows
rem ***************** This is were you would install drivers and copy over files if needed ***********************
rem "%PETOOLS%\peimg.exe" /inf:{FULL PATH}\{DRIVER.INF} %ISOSOURCE%\Mount\Windows
rem ***************** Finalizing the WIM ***********************
"%PETOOLS%\peimg.exe" /prep /f %ISOSOURCE%\Mount\Windows
rem ***************** Deleting the ISO boot WIM so we can use ours ***********************
del %ISOSOURCE%\ISO\sources\boot.wim
rem ***************** Creating a compressed WIM ***********************
"%IMAGEX%\imagex.exe" /boot /compress maximum /capture %ISOSOURCE%\Mount %ISOSOURCE%\ISO\sources\boot.wim "WinPE2"
rem ***************** Closing the WIM ***********************
"%IMAGEX%\imagex.exe" /unmount %ISOSOURCE%\mount /commit
rem ***************** Building ISO ***********************
"%PETOOLS%\oscdimg.exe" -n -b%ISOSOURCE%\etfsboot.com %ISOSOURCE%\ISO %ISOSOURCE%\%ISONAME%

try this out, and tell me how it works.

thanks for the script it will definately come in handy.

I may have found out what was causing it however i have no way to verify it.

i had the old version of BDD 3.5 i think and the pe tools that came with it, i thought when WAIK and BDD 2007 installed they had removed the older versions but i must not have been paying attention to the installs.

i went through and killed EVERYTHING related to PE reinstalled BDD 2007 and WAIK and voila everything works

thanks again for the help

on a closing note i threw in msjetoledb40.dll to the system32 directory and regsvr32'd it in startnet.cmd (i have some vbs and hta scripts that use an access db on a lan share for direction to data backup and special images) now all my scripts work perfectly from PE including the DB calls.

Considering microsoft by design does not make things simple, the previously mentioned action was WAY TOO EASY to set up, and that worries me :-P

is it really that simple or am i missing something (i would like it to be that simple but i have to ask)

Thanks again for the quick responses today you've been a big help

Cheers,

Ryan Strope

Distributed Services

(Software package development/testing)

Lockheed Martin Systems Integration Owego

(Cyber City Computers)

ryan.strope@lmco.com

Quid quid latine dictum sit, altum videtur

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...