Professional Documents
Culture Documents
There are different methods to integrate (languages, updates, drivers, etc ...) in Windows.
Offline integration is usually done by mounting a disk image and adding things to it.
Standard methods would be:
Windows Automated Integration Kit (WAIK) for Windows Vista and Windows 7
Windows Assessment and Deployment Kit (ADK) for Windows 8 or Windows 8.1 Update
Online integration is usually done by adding a file or series of files to a computer system while the
computer is running (online). It does not refer to the connectivity of internet.
Prepare/Capture is commonly referred to as sysprep/audit mode.
It is most frequently accomplished by preparing a Windows install using Audit mode.
You can enter Audit Mode on most Windows Setups by pressing ctrl-shift-f3 while at the user creation
screen. It will set a status file %windir%\setup\state\state.ini to reflect booting into Audit Mode and
reboots the system immediately. When finished preparing the system, the user generally runs a Sysprep
program that wipes certain registry settings and user information to prepare the drive to be captured
for an install image.
Sysprep will change the Audit Mode back to the normal setup mode if you select the OOBE option (Outof-box Experience).
You can also enter Audit-Mode by running admin command prompt and navigating to
%windir%\system32\sysprep\ and running the command:
sysprep.exe /audit.
Mount the disk image. You can do this from admin command prompt by running command:
Dism /mount-wim /wimfile:c:\win81\sources\install.wim /index: 1 /mountdir:c:\mount
Make your changes. Mostly this involves setting a product key, adding a MSU or CAB file, or copying
something over to your image.
To set a product key in dism, you use admin command prompt again with a command such as:
Dism /image: c:\mount /set-productkey: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
To add a MSU or CAB package such as a kb file that you download from Microsoft Download Center or
Windows Update Catalog, you use command:
Dism /image: c:\mount /add-package /packagepath:c:\integration\kbfiles\x86
To copy things to your install disc, such as a driver directory, you have many options.
You could manually copy a directory to a mounted image directory. You could also automate it with a
few commands such as:
Mkdir c:\mount\Drivers
xcopy c:\integration\Drivers\* c:\mount\Drivers\ /cherkyi
that command will copy the contents of "c:\integration\Drivers\" and any subdirectories and files. This
is useful for a script. You can also delete files that you don't want on the Install, though I recommend
against it if you don't know what you are doing. I typically work with a couple commands:
Del c:\mount\somefileiwannadelete.txt /y or rd /q/s c:\mount\somedirectoryiwannaditch
unmounting the disk image. You can choose to save your changes or discard them with the commands:
Dism /unmount-wim /mountdir:c:\mount /commit or
Dism /unmount-wim /mountdir:c:\mount/discard
The discard command will clear all the files out of the mount directory and disregard any changes. That
is, they will not be saved back into the WIM file.
So, a simple script with some of these commands strung together could give you a basic offline
integration:
dism /mount-wim /wimfile:c:\win81\sources\install.wim /index:1 /mountdir:c:\mount
dism /image:c:\mount /set-productkey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
dism /image:c:\mount /add-package /packagepath:c:\integration\kbfiles\x86
mkdir c:\mount\Drivers
xcopy c:\integration\Drivers\* c:\mount\Drivers\ /cherkyi
dism /unmount-wim /mountdir:c:\mount /commit
You would make a text file and save it as a file such as: Integrationx86.cmd
The CMD extension lets you run the file from Windows as a script. You then simply run the script as
Administrator to go through the
entire set of commands.
An online system capable of working with the version of dism and files that you are trying to
integrate
DISM
No need to mount. The whole idea behind online integration of things is that it's only used for installing
system files or features. In this case, the operating system is running, so you don't mount anything. So
you skip the parts in the offline integration that have to do with mounting and replace certain parts of
the dism call.
Integration. This is done on an online image by replacing the /image call with /online.
This is most commonly done with Windows 8 and Windows 8.1 to enable NetFx3 from an install media:
dism /online /enable-feature /featurename:NetFx3 /all /limitaccess /source:X:\sources\sxs
In this case, the X:\sources\sxs is the sxs folder on a Windows 8.x mounted ISO file. You would replace
the X with the actual drive
letter of the mounted ISO file. The /all command tells it to add all sub-features. The /limitaccess
command tells it to not try
to connect to Windows Update to download the feature files from the Update Servers. This is useful for
the month or two after a
new Windows version such as 8.0 or 8.1 has become available and they haven't yet enabled the online
portions.
There's not much else you can do in /online mode; at least I haven't done anything else. MSU files are
not integrated with DISM while
online, and you set the productkey with SLMGR. TO integrate online updates you use the WUSA
program that's built into Windows.
To do online integration of all MSU files in the same folder as a script, you edit a text file to contain this:
@echo off
pushd %~dp0
for /f %%A in ('dir /b *.msu') do (echo == Installing Updates == "%%A" ...
C:\Windows\system32\wusa.exe %%A /quiet /norestart)
echo.
echo ########################################
echo.
echo == Updates installed ==
echo.
echo == Press any key to restart ==&pause>nul
echo.
shutdown.exe /r /t 0
You don't have to have the echo or restart commands, but it helps to keep track of your progress. Since
you always have to restart on adding a few kb files with WUSA, it's there for a reason. This script
searches the current directory for any .MSU files and installs them with WUSA. You run this command as
admin by right clicking the script and selecting run as administrator.
Prepare/Capture
Commonly referred to as Audit/Sysprep is simply preparing an online OS in a way that you can install it
later, possibly on another computer.
What you need:
Stuff to add
A capture method
Start Windows Setup from boot and select the partition where to install.
Let Windows Proceed until the User Creation Screen. At this point you enter Audit Mode by pressing
CTRL-Shift-F3, Windows will reboot and skip the user creation process. When you finally boot into your
installed OS, you will be greeted by a sysprep window.
Just ignore that for now.
Add drivers, updates and your personal settings (the directx runtimes, any Netfx updates, latest hotfix
files from Windows Updates, perhaps a WinRAR or 7-zip, maybe a bunch of Visual c++/basic updates.
You can also add things such as Microsoft Office.
"Additional info about Win8.x audit-mode:
Win8.x has a unique issue with Windows Update. It doesn't like to let you use it during Audit-Mode use.
So to get around this problem, you create a user like you normally would, but then reboot into auditmode and delete that user before capturing.
For example, in order to do a simple win8.x Windows Update sysprep/capture integration, the steps
would be something like:
1) Install Operating system and create a generic user. It doesn't matter what settings you use or what
you name the account
2) Run Windows Update from within win8.x (If very old versions of win8.x, you might need to either
reboot once or run admin prompt
command "net stop wuauserv" that will kill a bug that existed where the Windows Update application
wuapp.exe will seem like it is updating, but will never actually do anything. You can simply re-check for
updates after stopping the service once
3) Update all of your Windows Update hotfixes, updates, and whatever else you wish to add to
Windows
4) Run %windir%\system32\sysprep\sysprep.exe /audit as admin
5) Once in audit mode, go into user accounts and delete the account you made to install updates and
programs
6) Clean up temporary files such as extra directories created to store install files (c:\amd or c:\nvidia,
vcredist folders, etc) You can also
delete %windir%\softwaredistribution folder. That folder is created when you first run Windows Update,
and is not actually necessary for further use
7) Delete both the temporary account and admin account folders in the \users\ folder. (You don't need
them at all)
Substitute folder: Extract the ISO you used as a starting point to a folder. Ex: C:\win81\
Now, if you did a sysprep/capture, replace the install.wim and you're ready to create the ISO.
If you did an offline integration, you might want to re-compress the install.wim. If you add a lot of MSU
files it can save a few hundred megas. The way you re-compress an install.wim is by creating a new one
and exporting all the images to it. You can use the export tab of GImageX v2 or use imagex from the
WAIK tools. An example of a re-compression would be something like this:
imagex /compress maximum /export c:\win81\sources\install.wim * c:\temp\install.wim
move /y c:\temp\install.wim c:\win81\sources\
oscdimg: The tool you should use to create an ISO file with a boot sector is called oscdimg.exe and it's a
commandlinetool that you get in the WAIK tools folder.
oscdimg -bc:\win81\boot\etfsboot.com -u1 -lWin81DVD c:\win81\ c:\temp\OutputDVDName.iso
More dism command information can be found on technet:
http://technet.microsoft.com/en-us/library/hh825258.aspx
=====================================================
rem == 2. Windows partition
=====================================================
rem == a. Create the Windows partition.
create partition primary
rem == b. Create space for the recovery image.
rem == Note, adjust the size to match the size of the recovery image.
shrink minimum=15000
rem == c. Prepare the Windows partition.
format quick fs=ntfs label="Windows"
assign letter="W"
=====================================================
rem == 3. Recovery image partition
=====================================================
create partition primary
format quick fs=ntfs label="Recovery image"
assign letter="R"
set id=27
list volume
exit
For GPT without recovery partition diskpart script is:
select disk 0
clean
convert gpt
create partition primary size=300
format quick fs=ntfs label="Windows RE tools"
assign letter="T"
rem == Note: for Advanced Format Generation One drive
rem == change to size=260.
create partition efi size=100
format quick fs=fat32 label="System"
assign letter="S"
create partition msr size=128
create partition primary
format quick fs=ntfs label="Windows"
assign letter="W"
For GPT partition WITH recovery partition it's:
=====================================================
rem == CreatePartitions-UEFI.txt
rem == These commands are used with DiskPart to
rem == create five partitions for a UEFI/GPT-based PC.
rem == Adjust the partition sizes to fill the drive as necessary
=====================================================
select disk 0
clean
convert gpt
=====================================================
rem == 1. Windows RE tools partition
===============================================
create partition primary size=300
format quick fs=ntfs label="Windows RE tools"
assign letter="T"
set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
gpt attributes=0x8000000000000001
=====================================================
rem == 2. System partition
=====================================================
rem == Note: for Advanced Format Generation One drive
rem == change to size=260.
create partition efi size=100
format quick fs=fat32 label="System"
assign letter="S"
=====================================================
rem == 3. Microsoft Reserved (MSR) partition
=====================================================
create partition msr size=128
=====================================================
rem == 4. Windows partition
=====================================================
rem == a. Create the Windows partition
create partition primary
rem == b. Create space for the recovery image.
rem == Note, adjust the size to match the size of the recovery image.
shrink minimum=15000
rem == c. Prepare the Windows partition =========
format quick fs=ntfs label="Windows"
assign letter="W"
rem === 5. Recovery image partition ================
create partition primary
format quick fs=ntfs label="Recovery image"
assign letter="R"
set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
gpt attributes=0x8000000000000001
list volume
exit
Note that the recovery partitions are at the end of the primary hard disk and that they are created by
shrinking the primary partition. You could change the size of the shrink minimum to save a smaller
amount of room or larger amount of room. If you get real good with creating recovery partitions you
could make them very small and thus use up less room. This is not incredibly important for large
magnetic hard disks, but it can be very beneficial on smaller SSD hard disks.
The way you can use these scripts varies:
You can either create a script on a USB flash drive and thus call the script using something like this,
where F is the letter of the USB flash drive to partition the drive:
DiskPart /s F:\CreatePartitions.txt
or
you could use something like this, and put the MBRNOREC.txt along with a few other diskpart scripts on
the boot.wim index:2 root.
Diskpart /s X:\MBRNOREC.txt
Why would you want to put it there on X:?
Because that's where the command prompt defaults you to when you press Shift-F10 during setup. So if
you already had the files there, you wouldn't need to fumble around trying to find your files before you
apply them. You could also use this to your advantage making a choice script to decide which diskpart
txt script you want to run diskpart /s with.
Using a script to apply different schemes is incredibly useful for setting up different OS versions to their
default sizes. You never NEED to use a smaller system partition, but you could match them up with the
default ones that Windows Setup creates for certain OS versions.
Here's a list of sample MBR "SYSTEM" partition sizes:
Windows 7/SP1 and Server 2008/R2:
100MB system
Windows Server 2011 SBS Standard/Essentials and Home:
100MB system, 50GB Windows partition, 100GB minimum data partition
Windows 8/Server2012:
300MB system
Windows 8.1/Server2012r2:
350MB system
Now that you can manually partition your primary drive, how do you apply the image and get it ready to
run?
OK, putting the diskpart txt scripts in the boot.wim index 2 is a neat shortcut but if you make a script to
apply images, you'll need to know where the disk with the sources\install.wim or sources\install.esd is.
I'm sure a lot of people would have a very short solution, but I'd probably use something like this:
if exist d:\sources\install.wim set MYIMAGE=d:\sources\install.wim
if exist d:\sources\install.esd set MYIMAGE=d:\sources\install.esd
if exist e:\sources\install.wim set MYIMAGE=e:\sources\install.wim
if exist e:\sources\install.esd set MYIMAGE=e:\sources\install.esd
and so forth until z: Then you could call up the path to the image using the %MYIMAGE% tag instead of
messing with a faulty small loop that may or may not get it right.
Now, to apply the image, you do something such as:
Dism /apply-image /imagefile:%MYIMAGE% /index:1 /ApplyDir:W:\
That would be your Windows partition, and hence why you would apply the image to that partition.
Now, Make sure your "SYSTEM" partition (not Windows partition) is set to Active if you are using MBR
partition format.
This is done by using the "Active" command after creating the system partition.
An example where this is done correctly would be:
format quick fs=ntfs label="System"
assign letter="S"
active
This is important if you want your system to be bootable.
To make said system partition bootable, you run the following command:
W:\Windows\system32\bcdboot W:\Windows
It copies the files from W:\Windows to the system partition. You can also use the /l argument to change
the boot information language.
bcdboot w:\Windows /l en-us would set it to English - United States. es-es would be Spanish. pt-br
would be Brazilian Portuguese, and so on.
2) ProWMC conversions and Windows 8.x activation restoration on fresh ProWMC installs
To create a Pro with Media Center index in your install.wim, you use a dism /set-edition command. First
you need to locate your Pro index, usually Index:1 of a Windows 8.x Multiple Editions MSDN ISO. To set
the edition, first you need to make sure you are using 8.1 dism if you are
working on an 8.1 ProWMC.
For 8.0 you can use either 8.0 or 8.1. The dism command to change the edition would be something like
this:
dism /mount-wim /wimfile:c:\win81\sources\install.wim /index:1 /mountdir:c:\mount
dism /image:c:\mount /set-edition: ProfessionalWMC
dism /unmount-wim /mountdir:c:\mount /commit
Now you have changed your Windows 8.1 Pro image to a ProWMC edition, but you haven't changed the
name or the flag with which the install.wim will handle the image. The install.wim still thinks it's a
Windows 8.1 Pro image. And why wouldn't it? It doesn't read the image to find out which edition
it is set to. It is pre-defined when creating the image. So you have to use imagex to change the flags and
description.
I use the following command:
imagex /flags "ProfessionalWMC" /info c:\win81\sources\install.wim 1 "Windows 8.1 Pro with Media
Center" "Windows 8.1 Pro with Media Center"
The second copy of the name sets the description. You could use some big long diatribe if you wanted
to. I keep it the same as the index name to avoid confusion.
After those two things are done, the dism /set-edition, and the imagex /flags "ProfessionalWMC" with
the /info line, you now have afull-fledged ProWMC index. It's saved to your old spot that you had Pro in,
so if you still need Pro, you need to export things around and create a new install.wim.
I'll discuss creating a new exported install.wim in the next AIO section.
To restore activation on a ProWMC fresh install, you need to know a few things.
1) What the activation files are.
2) Where they are.
3) What Windows version you are using.
4) Whether or not it's worth saving.
The Windows 8.0 activation files are located in the directory:
c:\windows\system32\spp\store\
They are data.dat (hidden) and tokens.dat
In Windows 8.1 the directory is:
c:\windows\system32\spp\store\2.0
The files are also data.dat (hidden) and tokens.dat
Should I try to save these if I'm upgrading my system?
Well it depends how much you are changing. If you are putting more ram in your system, sure.
If you are changing a video card, absolutely.
If you are changing an entire motherboard, ram, and cpu, absolutely not. Don't bother trying to save it.
To save/restore the activation, simply copy the data.dat and tokens.dat from the store or 2.0 directory
and replace them on a fresh install. Simply copy them over the old files after installing directly to a fresh
ProWMC install. If no hardware changes have occurred in your system, there should still be enough
room in the slop to allow for different UUID or GUIDs or whatever else Windows uses to track things to
make sure you aren't trying to copy activation files to a completely different system. A common myth is
that you have to disable internet when working with activation files. This is false. You simply copy them
over the old ones. You can do it manually or with a script. As long as the SPP service is not currently
running, it will allow the copy. If SPP service is running, just wait like 30 secs and then try again.
After copying over the old files, just do yourself a favor and reboot. You don't have to, but with the way
that the cache stores things in memory it could be a little iffy when or how the system starts to realize
that you have activated files. Alternatively you could fumble around with different system screens until
it re-reads your system files, but it's faster and safer to just reboot.
longest, provided most of the images are the same. After the first one, they will be very quick. then
export CoreSL, Pro, ProWMC.
Now you'll have them all in a neat line:
Windows 8.1
Windows 8.1 Single Language
Windows 8.1 Pro
Windows 8.1 ProWMC
But you know what doesn't look right for an AIO?Well there's two things.
You don't want an index simply named "Windows 8.1" People won't know that's the Core SKU.
Also, what architecture is the index?
If you are going to add both x86 and x64 versions, as many people do, you want to let people know very
clearly which version they are using.
You could use gimagex for this as well but it's fairly easy to use imagex.
Do commands something like this:
imagex /info c:\temp\install.wim 1 "Windows 8.1 (Core) x86" "Windows 8.1 (Core) x86"
imagex /info c:\temp\install.wim 2 "Windows 8.1 (Core) Single Language x86" "Windows 8.1 (Core)
Single Language x86"
imagex /info c:\temp\install.wim 3 "Windows 8.1 Pro x86" "Windows 8.1 Pro x86"
imagex /info c:\temp\install.wim 4 "Windows 8.1 Pro with Media Center x86" "Windows 8.1 Pro with
Media Center x86"
Now you'll have your install.wim, but you have to transplant it over an appropriate setup image. Cut the
install.wim and navigate to your win81x86\sources\ folder. Paste it and overwrite the old one. You could
re-iso the file as I do using oscdimg so that you can load it in a VM or just use it as an unmodified image
AIO where nothing is integrated. To do this run the oscdimg commands from previous post. Note the
UEFI boot recommendation for x64 setup images.
If you use both x86 and x64 versions in a single AIO, you must to use x86 setup files. You can boot and
install an x64 image from an x86 setup disc if only the install.wim is changed, but you cannot always
setup x86 versions from an x64 setup disc.
What if the processor only has 1 core? It's generally bad practice to mix setup versions and try to use
x86 setup files for every AIO, so try to make an x86 version and an x64 version. The amount of
headaches you'll save with people who are trying to do "Repair your computer" or Full upgrading
from a previous OS will be enough to make it worth the extra disc.
You shouldn't try to stuff everything on one disc as a general rule. Leave x86 on an x86 disc, and leave
x64 on an x64 disc.
Well, when you get more practiced at AIO making, you can have something like 18 images or more for a
single disc.
Then if you are making both x86 and x64 versions, you can create a master script that calls two subscripts. That is a good way to log your progress from the dism logging.
You can integrate all the images in a loop, which is the best and cleanest way to handle it. Or you can
simply copy/paste each loop iteration for each index and change the numbers. I'll give you an example
from my recent 8.1 AIO scripting:
x86 script is:
@echo off
for my 8.1 using 8.0 files, it would definitely fill up a night. You simply extract your baseline
image to the appropriate directories you list in your script. I use win81x86 and win81x64 respectively so
that I'll remember where to put them and I don't make simple mistakes. It happens more than you'd
think if you use long complex directory names, especially ones with spaces where you need to
remember to use quotation marks.
Aside from the index preparing and scripting of integration, that's all there really is to it other than
testing. Believe me, you want to test your work.
Simple mistakes such as accidentily exporting your x64 image to your x86 folder or having dism fail to
integrate kb files past a certain problem file, are common. Which brings up the last topic.
You don't have to use the $OEM$ folder structure necessarily. You can simply mount the index and copy
the files to the mount\windows\setup\scripts folder. This is the way I do it since the scripts I run
sometimes vary from index to index. It's hard to have one index that is not activated, and then have the
next one be pre-activated if you use an $OEM$ folder structure, because it will run the one and only
script present. It doesn't discriminate.
So I've taken to having multiple $OEM$ folder structures that I save in my integration folder and use an
xcopy command.
It goes something like this:
dism /mount-wim /wimfile:c:\win80x86\sources\install.wim /index:1 /mountdir:c:\mount
if not exist c:\mount\windows\setup\scripts mkdir c:\mount\windows\setup\scripts
xcopy e:\OEM\x86\$oem$\$$\setup\scripts\* c:\mount\windows\setup\scripts /cherkyi
dism /unmount-wim /mountdir:c:\mount /commit
dism /mount-wim /wimfile:c:\win80x86\sources\install.wim /index:2 /mountdir:c:\mount
if not exist c:\mount\windows\setup\scripts mkdir c:\mount\windows\setup\scripts
xcopy e:\OEM\PAx86\$oem$\$$\setup\scripts\* c:\mount\windows\setup\scripts /cherkyi
dism /unmount-wim /mountdir:c:\mount /commit
So with those few tricks you could make a baseline image with 9 unactivated indexes and 9 activated
indexes having exactly the same kb files integrated for all, but having different scripting for the different
types. It's more difficult to deal with mounting each image, copying over different files, and then reexporting to a temp image. Some people can't really wrap their minds around it and can't seem to do
itcorrectly, so I saved it for the last topic, though I don't feel like it's very hard.
As to the contents of the pre-activated index, that's a whole 'nother story. It's fairly easy for Windows
Loader, but since that no longer works for KMS stuff, you either need a silent activator, or a series of
commands in a script form.
So with those few tricks you could make a baseline image with 9 unactivated indexes and 9 activated
indexes having exactly the same kb files integrated for all, but having different scripting for the different
types. It's more difficult to deal with mounting each image, copying over different files, and then reexporting to a temp image.
As to the contents of the pre-activated index, that's another story.
It's fairly easy for Windows Loader, but since that no longer works for KMS stuff, you either need a silent
activator, or a series of commands in a script form.
Here one example of $OEM$ folder para descargar.
http://www.linkbucks.com/Wan0
zorro48