2014-10-08

Custom Windows Installation -- Glorious Stalemate and Wrapping Up

Picking up from a few days ago --


Success to our Friends ...

I found the time last night to re-do the image-creation process. This time, of course, I had the benefit of hindsight ("Burn me once, etc. etc. etc.") -- and so I made sure that I included imagex.exe in the WinPE image.

(i.e. -- before executing oscdimg ... --
copy [...AIK...]\tools\x86\imagex.exe c:\winpe_x86\iso\
This will make imagex.exe available in the USB's root directory.
)


And it worked! Oh, imagex needed at least 15 minutes to compile an image of my installation, and the resulting image was huge -- but regardless --


... Confusion to our Enemies ...

There was one thing that happened that was odd, very odd indeed.

After I finished creating the new install.wim, shutdown, unplugged the USB stick, and rebooted -- my Windows seemed to be broken.

That is, it would go into "New Install Setup Action Mode!" and announce that it was "Starting Services" -- and then give me a panic-stricken message that ...
"o hax could not complete setup zomg"
(At least, I'm pretty sure that's what it said.
Anyway, I despaired almost immediately.
But if there's one thing I've taken to heart over the years, it's that "if something doesn't work, you're obviously not trying hard enough". So I clicked "OK" to reboot.

It popped up again. I clicked "OK" again.

We went round and round three or four times.

And then -- quite suddenly -- Windows finished "Starting Services" and moved on to other activities.

I don't know exactly what happened -- but we must have had incremental fixes, bit by bit, until it Just Worked.


... God save the Queen! (if she converts)

So I rebooted into Windows, ran through the set-up and activation routines, and -- blam -- we were back. All of my user-preferences were gone, but all my applications were still there.

So I used ImgBurn in "Build" Mode to create a new ISO.

This was only a little tricky, as I'd never used this mode before. ImgBurn doesn't allow you to edit an ISO in situ, apparently; you've got to create a brand-new one.

So I mounted up the vanilla installation ISO, copied all the files into a temporary directory, overwrote the existing "[...]\sources\install.wim" with my new version, and fed that temporary directory to ImgBurn.


The one thing I was not expecting from all this was the size of the thing.
My vanilla Windows 7 Home Premium install-disk tops out at about 4.4 GB.
This custom image rounds out to 9.4 GB.


Yup, that's not fitting on my 8 GB USB stick. I'll have to order a new one.

Fortunately, USB sticks are dirt-cheap. Plus, I'm not planning on re-imaging this machine anytime soon.

So -- into the NAS for archiving!
And now I'm the richer by one custom Windows installation!


What's next?

  • Re-do the custom-image process -- and archive that image! baby, oh, baby ...
  • Move the CPU to a back-room/closet -- CHECK and it's AWESOME
  • Get another NIC
  • Make a standard VM image
  • Make a flock of VMs -- a router/firewall/proxy, a NAS/DLNA server, an Apache server, ...

2014-10-07

Custom Windows Installation -- intermission

Well, if it's not one bloody thing ...


In a spirit of adventure, I've been writing this whole series as I go -- all the while praying that I won't mess something up and be unable to take screenshots, write ineffable commentary, etc.


Well, it turns out my steps were incomplete (in a very fun way). To be more specific, the steps to create the WinPE boot-device were incomplete.

So imagine my surprise when (after a half-dozen hurdles) I successfully ran sysprep, rebooted into WinPE, and couldn't execute imagex.

"imagex is not recognized as an internal or external command, operable program, or batch file."

Umm ... no?

cd \ 
dir imagex* /s
...
File not found.

Well,  &$%*@%. It's not on the USB.


And about ten seconds of Googling found that -- yup, ImageX is an optional module you need to explicitly add to WinPE.


Well, &$%*@%.


So the happy conclusion of this series will have to wait until I have more time.


On the flip side -- I now have a bright-and-squeaky-clean Windows installation to play with! No hidden cruft lingering in the abominable pit of that Lovecraftian horror of nightmare incomprehension, the Windows Registry (and, like all of the sins of Man, probably seemed like a pretty good idea at the time).


So ... yeah. Now I know.

On the other hand -- fresh system!


So: onwards to glorious triumph!

  • Re-do the custom-image process -- and archive that image!
  • Move the CPU to a back-room/closet -- CHECK and it's AWESOME
  • Get another NIC
  • Make a standard VM image
  • Make a flock of VMs -- a router/firewall/proxy, a NAS/DLNA server, an Apache server, ...

2014-10-04

Custom Windows Installation, pt. 3

So we've prepped our 'Doze environment and created the WinPE minimal-boot USB stick.

We've still got two small steps left until the Big Plunge:

#3 -- Image your existing Windows Installation disk

Yes, you need to have one of these.
No, I'm not going to give you a copy of mine.
Yes, that is my final answer.
No, I would not like to phone a friend.

This phase is pretty simple: just insert your Windows DVD into your drive and use ImgBurn to make a copy of it!

Of course, it makes for a pretty sizable ISO -- just over 4GB. Make sure you have the room -- not a problem if you removed all non-absolutely-turbo-vital programs ...


And that takes forever and ever and ever and then it's over. Like puberty, but not as messy.

#4 -- Clean your Windows installation

This is the last of the small steps -- but I spoke too soon earlier. This is pretty inextricably bound up with the Big Plunge, so make sure you're ready to proceed before, well, proceeding.

  1. Remove the AIK
    We don't need it anymore. Besides, you don't want it included in your custom installation, right? (What are ya, some kinda weirdo?)
  2. Run SysPrep as an Administrator
    Go to C:\Windows\system32\ and execute sysprep.exe (as an Administrator).

    In the resulting window, select "Enter System Out-of-Box Experience (OBBE)"
This image taken from the original source which inspired this series.

This will remove all registration and machine-specific information from your Windows installation! After all, you might go on to use this custom installation on multiple machines, one after the other. You don't want to be tied to any particular machine out of the box.


After this, you're ready to reboot.

You're going to want to prepare two things in advance:
  1. Insert your WinPE USB stick, to give your computer something to boot off of.
    Note: upon rebooting, you'll probably need to explicitly tell your computer to boot using the USB stick -- follow the "Choose Boot Device" message (or similar) that appears on your boot-screen.
  2. Prepare the list of WinPE commands:
    Once you boot into WinPE, you'll need to:
    1. Identify your hard-drive's letter.
      Because WinPE boots as the "real operating system", and it's booting of the USB stick, it'll list that as C:\. You need to determine your old hard drive's letter.
      diskpart
      select disk 0

      "List volume"
      [you'll then see your hard-disk's drive-letter; remember it!]
      exit
    2. Make an image of your hard-disk.
      Supposing that your hard-disk letter is D: ...imagex /capture D:\ D:\install.wim "My Windows Partition"

Once you've captured the "My Windows Partition" image, you'll want to reboot again -- but back into your hard-disk this time. There's still one more piece to put together before all this is over.

See you on the other side!

2014-10-02

Custom Windows Installation, pt.2

OK, OK ... so we're going to make our very own Frankendows custom Windows installation.

#0 -- Get all needed software

OK, I forgot to make sure that my toolbox was stocked.

We're going to need a couple of pieces of software, in addition to the ones explicitly named in Part 1:

  • Some kind of ISO-maker
    I've been using ImgBurn for some time now, and from what I've seen, it's a thoroughly well-behaved program that does exactly what it says on the tin.
  • Some kind of ISO-mounter
    You're going to need the ability to mount the ISOs you make as proper CDs. I've had good luck so far with VirtualCloneDrive.

Besides that, you'll need to get the Microsoft Windows Automated Installation Kit (AIK) -- but we mentioned that back in Part 1.


#1 -- Prep your Windows Environment

That means ...
  • Uninstalling everything but a few essential programs.
    And by "essential" I mean "you absolutely have to have them and you don't mind paying the cost with a bigger Windows disk.
    For my part, that means I'll be keeping:
    • Flash, Silverlight, Java
    • Dropbox, Google Drive
    • Chrome
    • Notepad++
    • 7zip
    • VLC
    • PuTTY
    • Avast! and Malwarebytes
    • f.lux [which is an absolutely-wonderful little gizmo, by the way]
    • Sumatra PDF [fantastic as a lightweight PDF viewer]
    • Skype
    • Revo Uninstaller [another fantastic utility]
    • Handbrake [as I'm in the middle of digitizing all my DVDs]
So gone is Steam, Eclipse, all those GOG games I keep neglecting, all those mods and mod-organizers for Skyrim and KSP, ...

  • Get ALL TEH WINDOZE UPDAETS!!!!
    We don't want to waste time downloading updates and Service Packs out the wazoo, do we? Get them now, so we never have to get them again!
  • Install WinPE
    As WinPE comes in the form of an ISO, you'll have to mount that ISO in order to install it ...

... and (if you've been a good boy and disabled Auto-Run) start the installer ...



That should take a while, right?


#2 -- Make your WinPE Boot-USB

... You do have a spare USB stick lying around, right?

So -- you've installed the AIK. Now you need to use part of it to make your WinPE boot device -- which'll have, as we said in Part 1, a bare-essentials copy of Windows on it.

So -- you'll want to start the AIK "Deployment Tools Command Prompt" as an Administrator.


This'll give you the unspeakable and horrific WinDOS command-prompt.

Anyway: now we get to execute some commands! (I know, right?)
copype.cmd x86 C:\winpex86\ISO\sources\boot.wim


Magic ensues.

Behold -- the boot image has been created!


Now:
copy C:\winpe_x86\winpe.wim C:\winpe_x86\ISO\boot.wim

Even deeper (and more talkative) magic ensues.
Our first command created a boot image. Just as discussed in my first series on Archlinux, we need to give the computer a relatively-simple boot-program to munch on when it wakes up first thing in the morning.

This second command creates a more-general system image, with all the other files we'll need to run our (extremely minimal) copy of Windows.


Finally, we need to package the boot and system images together into a single ISO (so we can burn it to a CD or USB).
oscdimg -n -bC:\winpe_x86\etfsboot.com C:\winpe_x86\ISO C:\winpe_x86\winpe_x86.iso
Don't put in your own newlines, obviously ...


And hooray -- we have our WinPE boot image!

Now we just need to push it onto a USB stick and make it bootable.


#2.1 -- Go On, Stick It In

I had a spare USB stick lying around, with a 2GB capacity (which is waaaaaay overkill, bee-tee-dubs). I decided to use that for my WinPE boot device.

To actually put the WinPE ISO on the USB stick, though, is not as straightforward as copy-paste. We need to work some minor arcana to let the computer know that the USB is bootable.

I love one-button solutions, so I used WiNToBootic. You don't even have to install the thing, just unzip and run!

Once WiNToBootic is running, just drag-and-drop the ISO we created into it. That ISO will be at C:\winpe_x86\.


A few moments of deep magic pass, and it's done.



So we've prepped Windows and created our minimal boot-Windows stick. Next we need to image our existing Windows DVD, clean the existing Windows system, boot into WinPE, ...

But that'll all have to wait til Part 3.