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.

2014-09-29

Custom Windows Installation, pt.1

First things first.

For whatever reason, my desktop isn't playing nice with VirtualBox -- every VM I try to start encounters kernel panics left and right.

Obviously this is a fantastic time to wipe everything and start from scratch.


But because just doing a simple reinstall isn't awesome enough, we obviously have to make a completely custom Windows installation!


For the duration, I'll be following the broad directions given in this Spiceworks article ...


So -- first things first ...

#0 -- The shape of things to come

The instructions linked above look awfully useful -- but what the Unprintable Hades do they mean?!?

  1. Prep your Windows Environment
    In other words: make sure that the software you have installed right now is what you want in your future custom installation.
    That's because (if my read is accurate) this process will basically take a snapshot of your current system -- at least with regard to installed programs, device drivers, etc.
    Bear in mind: this is a good opportunity to weed through all the cruft that normally accumulates -- one-off utilities that you never used again, Steam games that have so far failed to do anything more than take up space, ... y'know, cruft.
  2. Create WinPE boot-disk
    WinPE is the "Preinstallation Environment" -- the bare-bones version of Windows that loads off the CD when you're doing a fresh install.
    We want a stand-alone PE disk so that we can work on our current install -- say, to make an image-file of it -- without having it "on" at the same time.
  3. Clean the Environment
    We'll use the Automated Installation Kit (AIK) to wipe all personal- and verification-specific data from the environment. This will make it into a "general" installation. If we reboot into Windows at this time, we'll just have to re-enter all that verification stuff; but if we image it at this point, we'll have a general, machine-inspecific version of Windows!
  4. Reboot into WinPE and image the system!
    ...

    Yeah!
  5. Rip the Windows installation disk to ISO.
    To make a custom Windows installation, we need a regular Windows installation to mess with. This is pretty simple; we can use any old ISO-maker.
  6. Package the image into the Windows installation files.
    Finally, we take the image (a .WIM file -- Windows Image -- yuk yuk yuk ...) and stick it into the ISO we made in #5.

Sounds good.

What happens now? (Part 2, obviously ...)

2014-09-24

The Glorious Plan

At the very beginning of this blog, I promised you, my Adoring Public, a whole library of VM images, configurations, instructions, smarts, goodies, oodles, and whatchamacallits.

Unfortunately, my desktop scream-machine has decided that it no longer likes VMs, and has screaming fits whenever I try to instantiate them.

But a gentleman keeps his promises.
I'm not exactly sure how that applies to me, as I have neither a coat-of-arms nor any landed property -- but whatever.

So there's a bright side to all this: I get to tinker, and you get to watch me do it.

And have I got a plan for you!


Here it is, oh Adoring Public -- the Glorious Plan!

  1. Recreate the desktop in all its virginal glory -- make a fresh Windows 7 installation.
    ... but ...
    We'll customize the installation so all those useful little programs -- 7zip, TeraCopy, Steam, ... -- are included in the install!

    Which'll save time for what is truly important: Skittles(?!?) tacos and beer.

  2. Create a standard Archlinux VM image.

    Ideally, having a standard image will let us rapidly deploy a whole constellation of VMs, and give us more time for important stuff: playing with weird network configurations.

  3. Scrap my existing server, and use the Windows desktop / VM-constellation as the server.

    This'll entail a couple of other things:
    1. Relocate the desktop to a back room (to be out-of-sight, &c.)

      (Especially pertinent as my five-month-old daughter grows up and learns all about pouring juice into things, followed shortly by learning all about the joy of putting out electrical fires ...)
    2. Put in a lot more storage.
      My desktop has a cool terabyte. Which is awesome for Steam gaming. And lousy for a NAS.
      I want to store my entire music collection! And all my DVDs! And every crappy picture of every middling dessert I've ever looked at!
      And that means I'll need as much storage as I can get -- at least another terabyte.
    3. Install another Network Interface Card.
      Right now the desktop has an NIC built into the motherboard, which is great.

      But we want this machine to eventually provide services to the entire network -- which includes a firewall. And our firewall won't amount to a hill of beans carrots if it can be bypassed. We need to make sure that all network traffic needs to go through the firewall.

  4. ?????

  5. Profit!

Up next: How I Learned to Windows (And So Can You!)

Interlude - Windows Wirtualization Woes

This series on creating a base Archlinux VM image has been awesome. As often as I've done an Arch install before, I've still learned a lot from writing the series.
They say that you never actually know something until you can teach it back; and writing about something -- say, choosing the best file-system -- has forced me to revisit all sorts of topics I had previously learned "just enough" about.


Anyway -- I had quite literally gotten to the last post in this series -- when my VirtualBox broke.

Or my Windows broke.

Or something broke -- I don't know which. Anyway, my VirtualBox doesn't work anymore.

(If I try to start an x64 VM, the "loading" message sticks around like a lazy child who won't move out of your basement. And I can't even load a 32-bit VM without getting "virtual kernal panic OMGeeeeeeee!!!!!!1" messages.)


I've tried re-creating the VM from scratch, I've tried the re-install cycle a dozen times, I've tried mucking around in the registry, -- no joy.


So -- unfortunately -- I haven't been able to get around to uploading this work-in-process VM image to Dropbox yet. It's still infuriatingly DIY.

On the other hand, it has given me a whole slew of ideas on how to Make My Stuff Better.
I'm thinking: 
  • consolidate my antique server-box into my (high-power) desktop as a VM,
  • split my monolithic server into a fleet of VMs dedicated to particular services,
  • finagle my desktop's network to pass through my firewall VM, 
  • ...

This and more coming up! Stay tuned!