Showing posts with label virtual pc. Show all posts
Showing posts with label virtual pc. Show all posts

Friday, October 15, 2010

Pros and Cons of Virtual Test Machines

Most people know what I’m talking about when I say “virtual test machines”, but I’m sure some of you do not.  Or aren’t 100 percent sure anyway.  In any case, it is simply the practice of setting up virtual machines (aka “guest” computers) to support testing of various things.  In my particular case, it involves software packaging and deployment testing, but I’ve used this for modeling Active Directory migrations, SMS and ConfigMgr deployments, Group Policy modeling and management, scripting, and just plain old diabolical fun.

Most anyone working in IT that uses VMware, VirtualPC or Virtual Box, or whatever, is well aware of the good things it provides.  It makes life easier.  But there are always caveates.  Nothing in IT is a panacea of pure goodness. There is always something to be careful to avoid or prepare for.  Virtualization is no different.

I will say that there are more good things (benefits) than bad things (drawbacks, disadvantages), so in the end: proceed.  All I’m doing is shining a flashlight on a few creeky boards you may step on eventually, so keep your eyes open.

Pros

  • Protected isolation
  • Faster provisioning
  • Faster roll-back via Snapshots
  • Multiple test platforms via Cloning
  • Portability
  • Less hardware, reduced footprint/power/heat

Most of these are self-explanatory.  Virtualized computers provide a protected bubble in which to do things that would otherwise cause changes that are difficult (or impossible) to recover from.  A mistake with a Group Policy in a production environment can be disasterous and ugly.  The same mistake in a virtual environment is much more easily undone.  The usual advantages cited for data center virtualization apply equally to desktop virtualization. 

I will say that I give a slight tip of the hat to VMware Workstation for “snapshots” over VirtualPC.  I don’t recal VirtualBox providing this feature either, but it’s a HUGE benefit to virtual testing.  Not just for being able to “roll back” (aka “revert”) but also for easily building state trees which allow you to fork one virtual machine into many in short time, each having a unique delta over the previous.  For example: a baseline machine, then snapshots for adding various applications, service packs, and combinations, maybe six or seven machine states you can jump to at any time.

But as I said: there are caveates.

Cons

  • Domain synchronization
  • Tools / Additions updates
  • Hardware Interfaces
  • Isolate “test” from “production” for availability/management

Let me explain these a bit more:

Domain synchronization comes into play if you join your virtual machines to a functional Active Directory domain.  Each computer in a domain environment synchronizes its own password with the AD on a regular schedule.  If you roll a virtual machine back to a state that preceeds the most recent synchronization, guess what happens?  It’s like trying to logon with your older password.  BZZZT!  Fail!  The computer will display messages at logon stating the the domain controller could not be found and so on.  Simply rejoin the virtual machine to the domain to reset it, then re-snapshot it and delete the older snapshot (so you don’t do it again).  You will need to do this about once per month typically.

Tools (aka “Additions”) updates.  These are special installations that come with the virtual machine software which are installed into the virtual “guest” computers.  These packages provide enhanced interface between the virtual machine and the physical host.  Usually they update the video and network drivers, but may also add things like drag-n-drop or clipboard support, USB plug-n-play support and so on.  VMware updates these fairly often (a few times a year).  If you update VMware Workstation from 7.0 to 7.1 or 7.1.2 (etc.) it will also prompt you to update the tools installations in each virtual machine.  The more virtual machines you have, the more work you have waiting for you.  And when you use snapshot trees you will need to open each captured state in the tree and update the tools as well.  A bit of a pain, but it scales with the number of virtual guests you use.

Hardware interfaces.  Some software requires connecting to a hardware device which may or may not behave well with a virtual machine.  Some older (“legacy”) parallel and serial port devices, or certain USB devices, may not auto-detect between the physical port and the software running in a virtual machine.  In some cases, you will still need to maintain a physical test computer for such purposes.  This is not at all uncommon.  If you support hundreds of applications, you won’t typically be able to go completely virtual with your testing.  But as Confucius said: “any virtual is better than none”.  Ok, he might not have said that.

Isolate “test” from “production”.  If you plan on virtualizing desktop computers for testing, that’s one thing.  If you’re going to do that with production computers, that’s different.  I won’t go into all the issues, because the list is forever long and I’m still burning my candle at both ends on a big project, but thinks of these aspects to your production environment:

  • Anti-virus and anti-malware centralized management (when VM’s rollback state constantly)
  • Active Directory and Group Policy settings (same)
  • Running push scans from a server (when VM’s are offline)
  • Deploying service packs and application updates (and VM’s rollback constantly or are offline)

It can be messy to manage.  It’s usually best for controlled testing.  I’m not talking about VDI implementations or MED-V or anything like that.  This is with desktop-oriented, virtualization of computers on top of physical computers.

I’m not at all trying to discourage anyone from virtualizing computers, especially for testing purposes.  I’m just saying that it’s not something to walk into blindly.  Plan ahead and it will be a smooth journey.

Friday, September 3, 2010

Building Your Own Group Policy Virtual Lab

It's a been a long time since I wrote anything about Group Policy.  I'm sure some of you are happy about that, and maybe wish I'd take even longer, but oh well.  You must endure the torture that my second-rate writing brings to unsuspecting eyeballs and those with challenged mouse clicking fingers.

Lot's of folks are skiddish (not Yiddish, an entirely different thing) about practicing and learning about Group Policy in a "safe" and protected environment.  Some will simply create a few "test" OU's and test user and group accounts in their production Active Directory environment.  That's risky.  It can actually be downright "stupid-dangerous".  Two words that go together like bacon and eggs, Tom and Jerry, politics and lying, and a few others.  The key word is "tatooing", which can render your environment, in technical terms: fucked up beyond all repair (that's FUBAR).

The better, smarter, safer way to go is using a virtual environment.  If you haven't used a virtual machine setup before, maybe you've just read and heard about the concept, it's very easy.  VERY easy indeed.  And not only cheap, but FREE.  I have to assume that if you're working with Group Policy, then you have an Active Directory environment nearby.  If you have Active Directory, then chances are you have Windows Server handy.  You are ready to go.

  1. Install a Virtual Machine product.  There are several free products to choose from, including VMware Player, Sun VirtualBox, and the ubiquitously sucky-ass VirtualPC from Microsoft, among others.  I prefer VMware Player or VirtualBox.  If you can afford VMware Workstation that's a better option since it supports "snapshots", which are very VERY helpful.
  2. Create your Virtual Machines.  You will need at least one Windows Server VM and at least one or two Windows client VM's.  For our examples, and because I **LOVE** Group Policy Preferences (or GPP's), I will recommend Windows Server 2008 or 2008 R2, and Windows 7.  If you need to support XP in your environment, then by all means: add a Windows XP VM to your mix.
  3. Prepare the Virtual Machines.  Go ahead and install the operating systems and name the computers and install any/all updates.  I also recommend downloading any utilities like Admin Tools, Resource Kits, Sysinternals tools, and so on.  Be sure to consider item #4 during this step as well.
  4. Be Careful with Network Settings!  While you are building each VM, you can leave the network setting to "bridged" or "NAT", so that you can download updates and utilities, etc.  But before you make the jump to creating the AD domain environment, move all your VM's into a private virtual network.  This is VERY important!  I won't dive into the procedure for this because it's best left to the documentation for your chosen product.  It's not difficult.
  5. Promote the first AD Domain Controller.  Go ahead and add the AD Domain Services role and run DCPROMO to create the first domain controller.  Make sure you are running in a private virtual network first!!  If you use Windows for DHCP management be sure to disable the built-in DHCP service provided by the virtual machine software.  Document the settings!  The Forest/Domain names, IP addresses, server names, admin and DSRM recovery passwords, etc.  After the DC is promoted and rebooted, be sure to give it some time to settle in, then run through your diagnostics to make sure it is operating properly.
  6. Join Desktop VM's to the Virtual Domain.  Set up each desktop VM and join them to the new domain.  Make sure they join properly and everything connects together.  This will feel like putting together a playset for your kids.
  7. Snapshot or Backup.  If you have VMware Workstation make snapshots of each VM to provide a fall-back restore point so you don't lose all the work you've done to this point.  If you don't have snapshots available, you can simply power down each VM (using the internal "Shutdown" not just killing the VM) and copy the pertinent config and disk files to another location.  The intent here is to avoid losing all the work you've done.  If you screw up your lab, or the physical host crashes, you can rebuild and get your lab back to this point in time and save yourself a lot of pain.
  8. Start Playing.  Now that you've got your lab up and running, and you have the safety net of a backup or snapshot, you should be ready to start trying things out.

As a standard practice, I recommend installing RSAT on one of your Windows 7 VM's so you can manage AD and Group Policy features from a desktop, rather than relying on logging into a DC every time.  This is usually more realistic.  It's not usually recommended to constantly log into a DC to do daily check-ups and modifications unless you have to.  This is especially true if the DC has other roles on it like File/Print, Web services and so on.

Even though you are in a VM environment, it is still a good idea to create test OU's and test user accounts, test groups, test computers, shares, and so on.  This offers you additional layers of safety.  It's easier to blow off a bad GPO configuration against a test OU and test accounts, than it is to recover the entire VM environment.

The scope and scale of your virtual environment is only limited by two things: disk space and memory.  Those are both limited by budget.  If you have the budget to expand your disk storage capacity (and redundancy) and add memory, do it.  It's worth it if you intend on making this a serious project.  There is no such thing as too much memory or storage capacity.  The more you have available, the more you will consume.  That's a fact of nature.

If you have enough resources available you can expand your environment and your testing to include things like sub-domains, multiple forests, multiple sites and site link replication, DNS configurations, DHCP scopes and options, VLAN's and so on.  You can also add other products to your environment such as Sharepoint/MOSS, System Center products like Config Mgr, SCOM, DPM, as well as Exchange, WSUS, and other products (not to mention scripting and non-Microsoft products).  It's also perfect for practicing those topics for your upcoming certification exam that you may not even have in your production environment.

But I digress.

The point of this article was to help with building a virtual lab to work with Group Policy.  I got a little sidetracked, but hopefully in a good way.  I hear from people all the time that say they are hesitant to practice with Group Policy settings for fear of breaking their environment or creating a mess they might have to dig their way out of (adding yet more work to their already busy day).  Having a virtual environment allows you to try things and not impact your real environment, so you can move ahead without the worries.  Take an afternoon, stay after work, or a weekend morning, and build your virtual lab.  It'll pay off for you, I promise.

Thursday, November 27, 2008

Patching Offline VM's. Not Just Yet.

Sheesh.  I saw this recent post about the 2.0 version of the "Microsoft Offline Virtual Machine Servicing Tool" and thought: "Wow!  Patch offline VM's?  Cool!"

Not so fast.

After reading the docs (one short doc actually) it turns out that it simply works with SCVMM to iteratively launch each offline VM, initiate a wuauclt scan, then fire off the update process and then shuts down the VM.  Smoke and mirrors.  I was really expecting something uber cooler than that.  Not that this isn't useful, it is.  But being able to inspect dormant VM's to generate a list of needed updates and then (drum roll please) be able to somehow slipstream the patches into the VM's while still being dormant.  

The patch process could simply stuff in a "run-once" registry entry to kick off a standard client bootstrap to download and install patches upon the next start-up.  That doesn't seem too impossible.  The VHD's are simply file-based encapsulations of the disk image.  It should be possible to mount the VHD like you would "slave" a physical disk, and comb through it to do what you need and then unmount it.  Why is it necessary to boot the whole VM to do this?  Doesn't make sense to me.

Monday, December 31, 2007

Windows Server: The Lazy Method

I'm a huge fan of automation. People typing things into forms repeatedly is to me what scratching nails across a chalkboard is to others. I despise it. It's an exercise in obsolescence. Filling out forms at doctor offices bothers immensely. Stupid. We live in an age where things like this could and should be made simpler and less prone to dumb mistakes and wasted time. How many more times do I have to write down my name, birth date, home address, phone number, insurance info, blah blah blah. Enough already!!! We're obviously still in the stone age.

2008: The Stone Age Continues.

Well, I will make a feeble attempt to save someone some unnecessary work. Here's a semi-compiled recipe for making a fully-unattended, automated, slipstreamed installation disk for Windows Server 2003 SP2. Y ou can use R2 if you prefer, doesn't matter. Some of this was taken from multiple sources, such as http://www.petri.co.il/ and elsewhere. Modified for my own benefit, hopefully yours as well.

Basic Steps:

  1. Make an ISO file from a Windows Server 2003 install disk
  2. Copy the i386 folder from the ISO (or install media) to a local folder
  3. Download and Extract Service Pack 2 to a different local folder
  4. Run the slipstream "update" utility to patch the i386 folder
  5. Add the i386 folder and other files back into the ISO image
  6. Add a WINNT.SIF unattend file to the ISO image
  7. Save the ISO image with a different name

Seven steps to freedom. Not quite, but it's better than nothing. So, let's get started. You'll need some sort of ISO management application to open, edit and save ISO files. I prefer UltraISO, but there are many others that work just as well (to some people).

  1. Open the ISO application and create a new ISO file from your Windows Server 2003 installation disk.
  2. Follow the directions at http://www.petri.co.il/windows_2003_sp1_slipstreaming.htm to slipstream i386 folder to Service Pack 2 (note: Substitute references to SP1 with Sp2 where appropriate).
  3. After you've added the files for SP2 back into the ISO, add a customized WINNT.SIF file (see below) to the I386 folder of your ISO image. Note that you should also make sure you copy the WIN51, WIN51IS, and WIN51IS.SP2 files to the root of the ISO image folder structure.
  4. Save the modified ISO image with a new name (avoid overwriting your original copy)

Now you're ready to either burn the new ISO to a disk, or simply mount it from any VMware or VirtualPC / Virtual Server, etc. guest machine to become the CD drive. Then you can boot, walk away and come back to find a fully installed, ready-to-use operating system. Simply rename it, install the latest patches, configure an IP address and you're ready.

This takes a LOT less time to create multiple servers than manually inserting a CD or DVD disk and walking through the install process. It also eliminates installing SP2 on each one. I think I once calculated this saved me almost two hours of time for each server I installed from a pre-configured installation source like the one described here.

Oh yeah, I almost forgot to include a sample WINNT.SIF file. Simply open this in Notepad and edit the items in red to suit your needs. Then save it before adding it to your ISO image. This will setup your server with a blank password on the Administrator account and automatically format the entire partition of whatever drive you install it upon.

Cheers! Happy New Year!

;SetupMgrTag
[Data]
AutoPartition=1
MsDosInitiated="0"
UnattendedInstall="Yes"
[Unattended]
UnattendMode=FullUnattended
OemSkipEula=Yes
OemPreinstall=No
TargetPath=\WINDOWS
Repartition=Yes
[GuiUnattended]
AdminPassword="*"
OEMSkipRegional=1
TimeZone=35
OemSkipWelcome=1
[UserData]
ProductKey=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
FullName="MY_NAME"
OrgName="MY_COMPANY_NAME"
ComputerName=WS2KSTDSP2
[LicenseFilePrintData]
AutoMode=PerSeat
[TapiLocation]
CountryCode=1
AreaCode=757
[Identification]
JoinWorkgroup=WORKGROUP
[Networking]
InstallDefaultComponents=Yes