Jump to content

Batch File for Integrating Vista Updates


Recommended Posts

Batch file / Guide for Integrating Updates, Drivers & Applications ( Unattended Vista )

Step 1: Install WAIK

Step 2: Create this Folders in the SAME LOCATION ( e.g. D:\ ) : Updates ; Drivers .

1) Updates. Place here:

- Updates (Hotfixes): .MSU; .EXE; .CAB files. DON'T USE "EXPRESS.CAB" FILES ONLY FULL VERSION CAB FILES !

- Applications to install with Setupcomplete.cmd: .MSI & .EXE files

- Autounattend.xml, e.g. Autounattend.xml with minimum info necessary for unattended install and:

1 - Manual Disk Partitioning

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UILanguage>EN-US</UILanguage>
</component>
<component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserData>
<AcceptEula>true</AcceptEula>
<ProductKey>
<Key></Key>
<WillShowUI>OnError</WillShowUI>
</ProductKey>
</UserData>
<ImageInstall>
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/INDEX</Key>
<Value>4</Value>
</MetaData>
</InstallFrom>
<WillShowUI>OnError</WillShowUI>
</OSImage>
</ImageInstall>
</component>
</settings>
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ComputerName>WORKSTATION</ComputerName>
</component>
<component name="Microsoft-Windows-Security-Licensing-SLC-UX" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SkipAutoActivation>true</SkipAutoActivation>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<AutoLogon>
<Enabled>true</Enabled>
<LogonCount>1</LogonCount>
<Username>ADMINISTRATOR</Username>
</AutoLogon>
<OOBE>
<ProtectYourPC>3</ProtectYourPC>
<SkipMachineOOBE>true</SkipMachineOOBE>
<NetworkLocation>Other</NetworkLocation>
</OOBE>
<TimeZone>Eastern Standard Time</TimeZone>
</component>
</settings>
</unattend>

2 - Automatically formating partition 1 on drive 0 and create one standard user called "User"

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UILanguage>EN-US</UILanguage>
</component>
<component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserData>
<AcceptEula>true</AcceptEula>
<ProductKey>
<Key></Key>
<WillShowUI>OnError</WillShowUI>
</ProductKey>
</UserData>
<ImageInstall>
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/INDEX</Key>
<Value>4</Value>
</MetaData>
</InstallFrom>
<WillShowUI>OnError</WillShowUI>
<InstallTo>
<DiskID>0</DiskID>
<PartitionID>1</PartitionID>
</InstallTo>
</OSImage>
</ImageInstall>
<DiskConfiguration>
<Disk wcm:action="add">
<ModifyPartitions>
<ModifyPartition wcm:action="modify">
<Active>true</Active>
<Format>NTFS</Format>
<Order>1</Order>
<PartitionID>1</PartitionID>
</ModifyPartition>
</ModifyPartitions>
<DiskID>0</DiskID>
</Disk>
</DiskConfiguration>
</component>
</settings>
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ComputerName>WORKSTATION</ComputerName>
</component>
<component name="Microsoft-Windows-Security-Licensing-SLC-UX" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SkipAutoActivation>true</SkipAutoActivation>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<AutoLogon>
<Enabled>true</Enabled>
<LogonCount>1</LogonCount>
<Username>ADMINISTRATOR</Username>
</AutoLogon>
<TimeZone>Eastern Standard Time</TimeZone>
<OOBE>
<ProtectYourPC>3</ProtectYourPC>
<NetworkLocation>Other</NetworkLocation>
</OOBE>
<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<DisplayName></DisplayName>
<Name>User</Name>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
</component>
</settings>
</unattend>

Please add you KEY between "<Key></Key>"

- Setupcomplete.cmd for installing Applications. ( see Windows Automated Installation Kit User's Guide for more about Setupcomplete.cmd ) e.g. :

@echo off
COLOR 9E
Title VISTA UPDATER ( Press : Y for YES , N for NO , P for PAUSE , C for CANCEL )

:Prepare Environment
echo.
Choice /C YNPC /T 5 /D Y /M "Prepare Environment"
if errorlevel 4 goto Exit
if errorlevel 3 goto PauseEnvironment
if errorlevel 2 goto SkipEnvironment
if errorlevel 1 goto ContinueEnvironment

:SkipEnvironment
echo.
goto PrepareUpdates

:PauseEnvironment
echo.
PAUSE

:ContinueEnvironment
echo.Please Wait...
echo.
cd /d %0\..
MD C:\Mount
FOR %%a IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO If EXIST %%a:\efi SET DVD=%%a:
XCOPY %DVD%\ C:\LRMCFRE_EN_DVD /E /G /H /I /Y
XCOPY .\Updates\Autounattend.xml C:\LRMCFRE_EN_DVD /I /Y
XCOPY .\Updates\*.exe C:\LRMCFRE_EN_DVD\SDK /I /Y
XCOPY .\Updates\*.msi C:\LRMCFRE_EN_DVD\SDK /I /Y

:PrepareUpdates
echo.
Choice /C YNPC /T 5 /D Y /M "Prepare Updates"
if errorlevel 4 goto Clean
if errorlevel 3 goto PausePrepareUpdates
if errorlevel 2 goto SkipPrepareUpdates
if errorlevel 1 goto ContinuePrepareUpdates

:SkipPrepareUpdates
echo.
goto InstallUpdates

:PausePrepareUpdates
echo.
PAUSE

:ContinuePrepareUpdates
echo.
XCOPY .\Updates\*.cab C:\Updates /I /Y
echo.
Expand -f:* .\Updates\amd64\*.msu C:\Updates\
echo.
DEL C:\Updates\WSUSSCAN.cab

:InstallUpdates
echo.
Choice /C YNPC /T 5 /D Y /M "Install Updates"
if errorlevel 4 goto Clean
if errorlevel 3 goto PauseInstallUpdates
if errorlevel 2 goto SkipInstallUpdates
if errorlevel 1 goto ContinueInstallUpdates

:SkipInstallUpdates
echo.
"%PROGRAMFILES%\Windows AIK\Tools\x86\imagex.exe" /mountrw C:\LRMCFRE_EN_DVD\sources\install.wim 4 C:\Mount
echo.
goto Drivers

:PauseInstallUpdates
echo.
PAUSE

:ContinueInstallUpdates
echo.
"%PROGRAMFILES%\Windows AIK\Tools\x86\imagex.exe" /mountrw C:\LRMCFRE_EN_DVD\sources\install.wim 4 C:\Mount
echo.
MD C:\Mount\Windows\Setup\Scripts
XCOPY .\Updates\Setupcomplete.cmd C:\Mount\Windows\Setup\Scripts /I /Y
echo.
MD C:\Mount\Windows\Prefetch
echo.
"%PROGRAMFILES%\Windows AIK\Tools\PETools\peimg.exe" /import=C:\Updates\*.cab C:\Mount\windows
echo.
"%PROGRAMFILES%\Windows AIK\Tools\PETools\peimg.exe" /install=*Package* C:\Mount\windows
echo.
"%PROGRAMFILES%\Windows AIK\Tools\PETools\peimg.exe" /install=*Pack* C:\Mount\windows
echo.
echo.List of packages in the current image. In the INS column, a plus sign (+) denotes installed packages and a minus sign (-) denotes not installed.
echo.
"%PROGRAMFILES%\Windows AIK\Tools\PETools\peimg.exe" /list C:\Mount\windows

:Drivers
echo.
Choice /C YNPC /T 5 /D Y /M "Install Drivers"
if errorlevel 4 goto Unmount
if errorlevel 3 goto PauseDrivers
if errorlevel 2 goto SkipDrivers
if errorlevel 1 goto ContinueDrivers

:SkipDrivers
echo.
goto BootDrivers

:PauseDrivers
echo.
PAUSE

:ContinueDrivers
echo.
"%PROGRAMFILES%\Windows AIK\Tools\PETools\peimg.exe" /inf=.\Drivers\*.inf C:\Mount\windows

:BootDrivers
echo.
Choice /C YNPC /T 5 /D Y /M "Install Boot Drivers"
if errorlevel 4 goto Unmount
if errorlevel 3 goto PauseBoot
if errorlevel 2 goto SkipBoot
if errorlevel 1 goto ContinueBoot

:SkipBoot
echo.
goto DVD

:PauseBoot
echo.
PAUSE

:ContinueBoot
echo.
"%PROGRAMFILES%\Windows AIK\Tools\x86\imagex.exe" /unmount /commit C:\Mount
echo.
"%PROGRAMFILES%\Windows AIK\Tools\x86\imagex.exe" /mountrw C:\LRMCFRE_EN_DVD\sources\boot.wim 2 C:\Mount
echo.
"%PROGRAMFILES%\Windows AIK\Tools\PETools\peimg.exe" /inf=.\Drivers\iaahci.inf C:\Mount\windows
echo.
"%PROGRAMFILES%\Windows AIK\Tools\PETools\peimg.exe" /inf=.\Drivers\iastor.inf C:\Mount\windows

:DVD
echo.
Choice /C YNPC /T 5 /D Y /M "Create Vista DVD Image File"
if errorlevel 4 goto Unmount
if errorlevel 3 goto PauseDVD
if errorlevel 2 goto SkipDVD
if errorlevel 1 goto ContinueDVD

:SkipDVD
echo.
"%PROGRAMFILES%\Windows AIK\Tools\x86\imagex.exe" /unmount /commit C:\Mount
goto Clean

:PauseDVD
echo.
PAUSE

:ContinueDVD
echo.
"%PROGRAMFILES%\Windows AIK\Tools\x86\imagex.exe" /unmount /commit C:\Mount
echo.
"%PROGRAMFILES%\Windows AIK\Tools\PETools\oscdimg.exe" /b"%PROGRAMFILES%\Windows AIK\Tools\PETools\x86\boot\etfsboot.com" /h /lLRMCFRE_EN_DVD /o /u2 C:\LRMCFRE_EN_DVD C:\Image.iso

:Clean
echo.
Choice /C YNP /T 5 /D Y /M "Cleaning up"
if errorlevel 3 goto PauseClean
if errorlevel 2 goto Exit
if errorlevel 1 goto Cleaning

:PauseClean
echo.
PAUSE

:Cleaning
echo.
RD /S /Q C:\Updates
echo.
RD /S /Q C:\Mount
echo.
RD /S /Q C:\LRMCFRE_EN_DVD

:Exit
echo.
EXIT

:Unmount
echo.
"%PROGRAMFILES%\Windows AIK\Tools\x86\imagex.exe" /unmount C:\Mount
echo.
goto Clean
echo.
EXIT

NOTE:

- The "Boot Drivers" are for Intel RAID/AHCI, just replace iaahci.inf and iastor.inf with your .inf files

- "install.wim 4 " it's for Vista Ultimate change the number according to your Vista version

- For Vista x64 replace x86 with amd64

- Please exit all other programs and use the built-in ADMINISTRATOR ACCOUNT !

even if (you run these batch in elevated mode) your account it's an administrator account and you have disable UAC, or you use "run as administrator".

- Tested with Vista x86 & Vista x64

If you're using XP try add start /wait at the beginning of every command and delete all "choice" lines or get choice.exe from xp x64, or vista, or...

Please let me know if you encounter any problems

Edited by Mercury_22
Link to comment
Share on other sites


To make things a bit easier as new updates come out, you can use the following code:

"%PROGRAMFILES%\Windows AIK\Tools\PETools\peimg.exe" c:\mount\windows /import=D:\Documents\SDK\Updates\*.cab

It's how I do it. Use a *.cab then it just adds all files with .cab in the folder. So as new updates come, it's simple to add them without editing the batch file.

Link to comment
Share on other sites

To make things a bit easier as new updates come out, you can use the following code:

"%PROGRAMFILES%Windows AIKToolsPEToolspeimg.exe" c:mountwindows /import=D:DocumentsSDKUpdates*.cab

It's how I do it. Use a *.cab then it just adds all files with .cab in the folder. So as new updates come, it's simple to add them without editing the batch file.

You're right! :thumbup Thanks!

I've made the modification in the first post! :hello:

Edited by Mercury_22
Link to comment
Share on other sites

Personally, I'd rather use Package Manager myself since technically peimg is for WinPE. Microsoft's WAIK does not mention using peimg as the way to integrate updates offline. It instead uses pkgmgr.

Since you are using peimg to install updates one-by-one, meaning using the for command to integrate each update one-by-one, you are not checking for dependencies.

However, package manager uses an xml file to integrate updates, which checks for dependencies.

See FireGeier's guide, which is a comprehensive guide from begininng to end, or this one just for updates only.

Link to comment
Share on other sites

Using wildcards makes peimg to install all in order (if you don't use wildcards just install them in ascending order) and since all the Hotfixes are the full version (not express version) you don't need to check for dependencies (Keep in mind that the Packs are getting installed AFTER Packages)

As for Microsoft's WAIK better check again Maybe you need this WAIK_doc_update_1.zip it's the update for WAIK User's Guide (Date Published:4/2/2007)

I WILL ALWAYS PREFER SIMPLE STRAIGHTFORWARD WORKING SOLUTIONS :thumbup ,but if you prefer complicated ... to a simple working solution be my guest!!! :blink::whistle:

Hello Mercury_22!

First of all: I don't want to dispute!

I've just one question:

Is there any side effect using peimg for a full Vista Version, cause actual WAIK help says:

PEimg.exe is command-line tool for creating and modifying Windows PE 2.0 images offline.

So from "official" side it's not designed to integrate something in the full Vista image. Don't missunderstand: I know that this does not mean automatically, that it does not work for a full image as well. It may work and it seems to work fine, but I can't tell for sure, cause I don't have the knowledge. So if you know exactly than please let me know.

WAIK help (actual) does say about pkgmgr:

Package Manager (Pkgmgr.exe) is a command-line tool that you can use offline to install, remove, or update Windows packages. You can add packages, provided as .cab files, to an offline Windows image. Package Manager can also enable or disable Windows features, either offline or on a running Windows installation.

...

Benefits of Package ManagerPackage Manager can do the following:

  • Install or uninstall hotfixes provided by Microsoft.

...

  • Accept an answer file as input (offlineServicing settings only).

...

  • Add packages to an offline Windows image.

  • Install or uninstall multiple packages with one command string.

...

Some packages require other packages to be installed first. Because of this dependency requirement, if you are installing multiple packages, do one of the following:

  • Use an answer file. By passing an answer file to Package Manager, multiple packages can be installed in the correct order. This is the preferred method for installing multiple packages.
  • Install or remove multiple packages in a single command as a semicolon-separated list. The packages can appear in any order. Package Manager installs or removes the packages in the correct order.

So if I use package manager I know for sure, that it will install the updates correctly to a full Vista image and check dependencies. This is the ONLY reason why I prefere this mehtod. It's not better or worser than yours and it's not more complicated or less complicated than yours. It's just the official way of doing it.

So far no one could answer or has answered my question and so I stay with the "official" way of doing it.

Expect from that I respect your and all the others work for sharing this mehtod and the knowledge about! :thumbup

But an exact answer of my question would be highly aprecciated!

Thanks 'n' regards,

Martin

Link to comment
Share on other sites

You seem pretty adamant about your method. I won't argue. Just trying to caution users on this forum that they need to look at both methods and decide which they should follow.

Again, just like FireGeier said, can you back up your claim from WAIK? He backed up his claim by posting snippets from WAIK. I'm curious to see where you saw you can use PEIMG for VISTA INSTALL.WIM, not just for the WINPE image. (The name PEIMG is a clue that it's for WINPE.) Lot's of people are using this methods it seems but doesn't mean it's the right method.

Again, let's calm down. We're not saying PEIMG doesn't work. We are just not sure if it really worked like it seems to have worked because it's not backed by MS official documentation that I've seen thus far.

** Also, simple does not always mean correct. **

Link to comment
Share on other sites

  • 1 month later...

@Mercury_22

I have merged six of your posts into just two. Please use the edit button if you wish to add content to the thread prior to another member creating a follow-up.

Thank you.

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...