Microsoft provides a web installer for WDK but not an ISO image. If you want an offline copy, you have to execute it to download everything. The problems are:
- If the online computer is sufficiently locked down, you might not be able to execute it.
- Even if you are allowed to, it insists on installing .NET 4.5 if it is missing. This is bad because downloading shouldn't require installation of anything.
- Even if you let it install .NET 4.5, it can't unless it has administrative privileges.
Instead of executing the installer, we can extract download information from it and download accordingly.
Procedure
- Download the web installers from a online computer from here.
There are actually two files:
wdksetup.exe
andwdktestsetup.exe
. The first installer installs WDK proper and the second installs WDK Test Pack. Download both. - If the online computer is somewhat locked down, take the downloads to another computer that you have more control of, and perform your work there.
- Use 7-zip to extract
wdksetup.exe
as if it were an archive. - Check that you have these files:
- Open the file
u12
with a text editor. (It contains XML data.) - Locate the line that contains the
downloadroot
tag:<downloadroot>http://go.microsoft.com/fwlink/?LinkID=392876</downloadroot>.
This URL redirects to a top level remote directory that contains our download files.
- We need to figure out exactly what this directory is. On the online computer,
open a web browser, type this address in the address bar, and press enter.
Ignore the 404 error which isn't important. We want the redirection result, which is reflected in the address bar:
http://download.microsoft.com/download/0/8/C/08C7497F-8551-4054-97DE-60C0E510D97A/wdk
Let's call this URL
$T
. - Go back to the computer you have been using (see step 2). Close the file
u12.
- Open the file
0
. - To make viewing easier, insert a carriage return after every close tag. The
following isn't exactly correct but will do: if you use Notepad++, try
'find-and-replace'. First, set the search mode to 'Regular expression'. Next, the
'Find what' field should be
>
and the 'Replace with' field should be>\n
. Then, click 'Replace All'. - Notice the lines that begin with the tag
<Payload id="..." />
. Basically they describe what you need to download. Other lines aren't important. - Skipping those lines with attributes
Packaging="embedded".
They describe files that aren't downloaded but are extracted from the web installer itself. Notice theSourcePath
attributes. Compare with the screenshot in step 4. Does it ring a bell? - Take note of the lines with attributes
Packaging="external"
. For each line, you must- record the
FilePath
attribute. It specifies where a file should be downloaded to, relative to the location of the web installer. If a file with matching file size and hash isn't there, the installer will download into that place. Put it differently, it expresses directory layout for placing downloads. - record the download URL. There are two cases.
- If
DownloadUrl
attribute is present, used as the download URL. - If absent, the download URL is derived from the
SourcePath
attribute. First, convert all backslashes inSourcePath
to forward slashes, then append the result to$T
(step 7) to give the download URL. For example, ifSourcePath
isInstallers\1c33d17316f25da4cbe42ca09b018509.cab
then the download URL would be:
http://download.microsoft.com/download/0/8/C/08C7497F-8551-4054-97DE-60C0E510D97A/wdk/Installers/c33d17316f25da4cbe42ca09b018509.cab
.
- If
To avoid confusion, when recording
FilePath
attributes, convert all backslashes to forward slashes. - record the
- Put the download URLs and
FilePath
attributes into two separate files,url.txt
andfilepath.txt
.url.txt
would look like:http://download.microsoft.com/download/0/8/C/08C7497F-8551-4054-97DE-60C0E510D97A/wdk/Installers/1c33d17316f25da4cbe42ca09b018509.cab
http://download.microsoft.com/download/0/8/C/08C7497F-8551-4054-97DE-60C0E510D97A/wdk/Installers/b6923fe117b94abbb1703c09cf619759.cab
.
.
.
whereas
filepath.txt
would look like:Installers/1c33d17316f25da4cbe42ca09b018509.cab
Installers/b6923fe117b94abbb1703c09cf619759.cab
.
.
.
- You now have
url.txt
andfilepath.txt
. Use the former for downloading and latter for moving the downloads to a proper directory layout. Typically, you use some kind of scripts for that purpose, e.g. with Cygwin bash script or Powershell scripts. - Once you have downloaded everything into right place, put
wdksetup.exe
to the top level download directory. Now you have an offline copy of WDK. - Repeat steps 3 to 16 differently:
- In step 3, open
wdktestsetup.exe
instead. - In steps 5 to 8, open
u11
instead. - In step 14, save the download URLs to a different file; e.g.
urltest.txt
. - In step 15, save the file paths to a different file; e.g.
filepathtest.txt
. - In step 16, put
wdktestsetup.exe
to the top level download directory instead.
- In step 3, open
- You now have an offline copy of WDK Test Pack.
Extra Remarks
- Although you can carry out steps 11 to 15 by hand, you'd better use some kind of scripting; e.g. Cygwin shell script or Powershell script.
- We separate the download information into download URLs and directory layouts, and place them into different files. The reason is that each has a different purpose.
- If during download you get 404 errors, it is OK: there could be lines in
u12
andu11
that are not used by the web installers and have no corresponding files on the server. Try doing a full install from the resulting download trees. If the installers report success, then these 404 errors are harmless.