Last year I got a nice gift from Microsoft for attending TechEd in
the form of a TechNet subscription. After receiving my activation
code I promptly upset my ISP by downloading everything I could get my
hands on. It was enough that I’m honestly shocked I didn’t get a
call or get turned off. Among those downloads was a product I had
toyed with in the past but never really gotten in to, Windows Home
Server (WHS).
For those not familiar with WHS it’s basically Miscrosoft’s home
backup tool based off the Windows Server 2003 SBS operating
system. It includes the ability to backup your home computers,
store shared files, stream audio/video, remote control your home
machines from the Internet, and much more. I had never really
played with it before because I lacked the spare change to buy the
necessary hardware. Enter virtualization…
My home computer has a decent amount of storage and a dual boot
between Windows 7 and Windows Server 2008 R2 Data Center Edition (gotta
love TechNet). While I could, and probably should, run WHS from
Hyper-V I spend most of my time in Win7 so running WHS from Hyper-V
wouldn’t do much good. That left me two free options for
virtualizing WHS on Win7: Virtual PC and Virtual Server. While
Virtual Server is probably the smarter choice I was already using
Virtual PC with XP Mode for a few legacy applications and test tools,
and I really didn’t want to lose my XP Mode applications. And here
in laid my conundrum and the journey began…because no just isn’t an
answer…sometimes.
It turns out that Virtual PC is more powerful than Microsoft wants
us to believe, or will support, if you take a little time to learn and
expose the VirtualPC.Application com-object. Or wait for some
sucker, like me, to learn it all for you and write a handy UI that
exposes a lot of the lesser known features of Virtual PC. After
exposing this underlying functionality I was able to run WHS via Virtual
PC with only real issue: WHS only runs while I’m logged on. Oh,
and even though WHS isn’t on the officially supported list it does work,
with the integration features and everything, once you get all the
Power Packs installed.
http://msdn.microsoft.com/en-us/library/dd796711(VS.85).aspx
Before I continue let me be perfectly honest with you, while the
Advanced Virtual PC Controls (AVPCC) does open some hidden functionality
in Virtual PC it is not, and never will be, a replacement product for a
serious virtualization suite like Hyper-V, vSphere, Xen or vmware
Workstation. What it does do is open some doors on a free tool to
give you some added functionality that isn’t very usable out-of-the-box.
What you need to use AVPCC:
Windows 7 Home Basic, Home Professional, Professional, Enterprise or Ultimate
Windows Virtual PC (http://www.microsoft.com/windows/virtual-pc/)
XP Mode is optional but highly recommended if you use the Professional, Enterprise or Ultimate editions of Windows 7
PowerShell 2.0 (win7 default having)
A little time
What the AVPCC UI does:
Pause, Hibernate[Save], Hard Restart, Turn Off a virtual machine (VM).
Resume or Turn On a VM, depending on the current state.
All VMs are started in “headless mode” which means without the console
window. The VM will simply run in the background.
Open or Close a VM console window. The Close Console
button will close the console window without hibernating, pausing or
turning off the VM. Choosing Open Console on a VM that is not
running will bring the VM into a running state.
Enable/Disable VM Hibernation. By default Virtual PC will
hibernate/save an unused VM after 5-10 minutes. This option
disables automatic hibernation or sets it to 10 minutes. If you
want to change that default edit the integer value “600” on line
544. The time to save is in seconds, so 600 seconds = 10
minutes. I’ll make that part of the UI if I make a future
revision.
Start at Logon/Remove Auto-Start. Creates a startup script
in the local user startup folder that will start a VM in a headless
state when you logon. Virtual PC does not allow a VM to start
before logging on, that I have found. This script that the “Start ”
link points to will be in a sub-directory of the directory the script
was run from. For example, if you ran AVPCC.ps1 from your desktop a
folder will appear on your desktop with a startVM.cmd file inside
it. Moving or removing that folder will break the
auto-start. For this reason I recommend you run the installer,
detailed below.
Hibernate All, will save/hibernate all VMs. Handy before a big online gaming session.
Resume All, starts all VMs.
And finally, you can Shut Down or Restart the guest OS.
Console parameters:
-install – When you run AVPCC.ps1 with
the -install switch you trigger, as I’m sure you guessed, an install
action. This simple installer shows you some legal mumbo jumbo and then
gives you an install screen.
By default it tries to install a copy of the script at
%programfiles%APVCC. If you have UAC enabled, and/or you are not
an Administrator, this may not work. This gives you two options:
1) run the PowerShell window as the Administrator (right-click the
PowerShell icon, select “Run As Administrator”) or 2) click the browse
button and point the install to …DocumentsAVPCC or …DownloadsAPVCC
or some other user profile folder of your choice. Option 2 is
probably the better choice.
The shortcut options will add a link to the script in the user
start menu and/or desktop. This is a double-click to start kind of
shortcut, not a direct link to the PS1 file.
Example, if you extracted the script to your desktop you would
use these commands in a PowerShell console to install AVPCC:
set-location “$env:USERPROFILEDesktop”
.AVPCC.ps1 -install
Once installed a shortcut like the one below will appear in any of the two spots you have checked.
[-start] “” –
This parameter will start a VM in “headless mode” given a VM
name. The actual “-start” parameter is optional as long as the VM
name is the first parameter passed.
Example, both of these commands would start the Windows XP Mode VM:
.AVPCC.ps1 -start “Windows XP Mode”
.AVPCC.ps1 “Windows XP Mode”
-Console (requires [-start] “”)
– This optional switch will start a VM via the console window
(VMWindow.exe). This is the same as double-clicking the VM in the
Virtual Machines window off the start menu or using the Open Console
button on the UI.
Example, to start Windows XP Mode with a console window you would use this command:
.AVPCC.ps1 “Windows XP Mode” -Console
There you have it. While I have tested this script
thoroughly on my home computers I can’t guarantee it will work for
everyone. I made it as system agnostic as I could, but if you do
run into any issues or bugs please let me know and I’ll do what I can to
fix them. Enjoy!
if your OS is 64 bit. please change the ShortLink Target to
‘%SystemRoot%syswow64WindowsPowerShellv1.0powershell.exe “& ‘C:Program Files (x86)AVPCCAVPCC.ps1′"‘
Download: AVPCC.zip