Offline Virtual Floppy Disks

22. January 2007 13:04 by smurillo in General  //  Tags:   //   Comments (0)

Virtual Server 2005 R2 SP1 Beta 2 includes VHD offline mounting, which can be very useful to read the contents of a virtual hard drive from the host, without having to load a virtual machine to do the job.

It might be useful from time to time for some people to have the same feature for Virtual Floppy Disks (.vfd) files. Just to give you an example, some tools depend on floppy disks to create backups that you may be interested on accessing from a physical machine.

This feature is not available with Virtual Server and it probably won't be (I don't think Microsoft would consider this a priority). But if you ever happen to need this, Ken Kato has created a Virtual Floppy Driver that you can use. It lets you view, edit, rename, delete or create files on a virtual floppy disk.

If you browse around the site you will also find a lot of VMWare tools that you might find useful.

Virtual Server scripts inside virtual machines

16. January 2007 05:38 by smurillo in General  //  Tags:   //   Comments (0)

If you are familiar with Virtual Server you know that you can use it to run scripts on the Host OS by attaching them to events, such as: turning on or off the Virtual Server service, or turning on or off a virtual machine.

But these scripts run on the host. What if you want to launch an application inside the guest OS?

Suppose you have a VBScript file called MyVBScript.vbs, and you want to run it inside the guest operating system of a virtual machine, or a bunch of them. You can create an ISO image that will contain an Autorun configuration that will execute this script. Once that's done, you can simply attach the ISO file to the virtual machine(s) where you want your script to run.

We will use the unauthorized ISO Recorder Power Toy to create the ISO file. ISO Recorder v2.0 works on Windows XP and Windows 2003. After you install this application you will be able to create ISO files out of folders in your filesystem.

  1. Create a new folder. Let's call it VMScript.
  2. Copy MyVBScript.vbs to the VMScript folder.
  3. Create a new file in the folder called Autorun.inf.
  4. Edit the Autorun.inf file and add the following lines:
  5. [autorun]
    open=wscript MyVBScript.vbs

  6. You can replace the text after "open=" if you want to execute a different command line, you can even launch an application with a UI.
  7. Save the Autorun.inf file.
  8. Right clik on the VMScript folder and select Create ISO image file.

    isorecorder
  9. Follow the wizard steps and a new file called RemoteScript.iso will be created. This is the CD/DVD image that you can attach to the virtual machine where you want the script to run. When you do, unless the Autorun feature has been disabled, your script will launch in the guest OS.

This is the same technique that Microsoft uses to launch the VM Additions and the precompactor. Now you can exploit this and even create interesting combinations. For instance you can attach a script to an event in Virtual Server that will attach your ISO file to a virtual machine.

IMPORTANT NOTES:

  • ISO Recorder is meant to be used for personal use, but it is used by a number of companies around the world. I have found no problems with it. Make sure you read the license agreement and documentation for this application.
  • AutoRun is normally enabled by default on Windows operating systems. For more information on this read CD AutoRun basics.
  • If you are not that familiar with Virtual Server and you don't know how to attach ISO files, manage removable media or attach scripts to Virtual Server, read the Virtual Server Administrator's Guide included in the installation package.

Acronis P2V/V2P

20. November 2006 16:32 by smurillo in General  //  Tags:   //   Comments (0)

There are news from Acronis on their "introduction" to the P2V scenario, and the quotes only mean that this is definitely not unexplored territory for them. Acronis True Image is a tool that helps you create a full backup of your hard disks. It is intended to be used for backup and recovery of your systems, but for years now, lots of IT administrators out there have found an alternative use for it, P2V. Although it wasn't meant to be used with this purpose specifically, it can certainly help do the trick.

P2V stands for Physical To Virtual conversion and the idea is that in order to explode part of the benefits of virtual machines, you must not only be able to create new VMs from scratch but also take your existing workloads and move them into a virtualized environment and back.

In the past if Acronis True Image was the weapon of choice for you to complete this task, then there are good news for you. Acronis has announced that a new product called Full Circle will be released this year, and although it holds all of the benefits for image cloning that you know and like, this product is specifically intended to fit your P2V needs, and as its name hints it, your V2P (virtual to physical) requirements as well. It supports both 32-bit and 64-bit x86 hardware, virtualization software from VMware, Microsoft, Xen, Parallels and SWSoft, and Windows and Linux guests, which makes it a very complete and universal proposal.

This product will be made available in December, no word on pricing yet. Read more about Acronis Full Circle here.

Seamless Remote Windows

17. November 2006 09:52 by smurillo in General  //  Tags:   //   Comments (0)

Making a remote desktop connection to a server just to run a single application is a very common situation. It is true you can configure a connection to log on automatically and even launch the desired application. For example you could specify the username, password and Notepad as the application to launch.

RDP01

But once you connect you get the same old Remote Desktop Connection window with just Notepad inside, which is still disruptive. Imagine if you could see a remote window as if it was running locally, resize it, move it and close it just like a regular window.

This feature is included in RDP 6.0, but if you want to try it without upgrading your system first, then you can access this article on the Code Project website. For developers out there this is a great introduction to the Remote Desktop Protocol, and for those who are not interested on getting to understand the protocol, you can just download the application from the author Martin Wickett on 2005.

Sysprep User Profiles

10. November 2006 12:42 by smurillo in General  //  Tags:   //   Comments (0)

There are times when you would want to Sysprep a Windows image and get it ready to join a domain and start creating user profiles. But what if you want to control the configurations and contents of those future profiles?

Windows offers a location for a Default User Profile. It is a hidden folder normally located in %SystemDrive%\Documents And Settings\Default User. To create a default profile all you need to do is log in to the machine, make all the changes you need and then log off. Once you are done copy all the contents of your profile folder to the Default User folder. You will need to do this offline or by using another account.

Profiles folders contain a file called NTUSER.DAT, this file contains all the configurations that are located in the HKEY_CURRENT_USER registry entry when the respective user logs on.

In general all of this works for future profiles even if you are not using Sysprep. But when you do use Sysprep there is a particular case that is not contemplated here. When you set the machine to log in the first time using a particular user account, the contents of that local profile will be copied to the Default User Profile that first time. In those cases you should set the defaults using that account.

SCVMM Guest OS Profiles

27. September 2006 06:33 by smurillo in General  //  Tags:   //   Comments (0)

As you may know already System Center Virtual Machine Manager can be used to create virtual machine templates. Templates have three main elements: a VHD file to use as a base for the template, a hardware profile and a guest OS profile. If you are familiar with Virtual Server you will have no problem understanding the first two, but the guest OS profile will be news to you.

The guest OS profile contains Sysprep information. When you create a virtual machine based on a template it will copy the selected VHD to it, use the hardware profile you select, and sysprep the virtual machine using the guest OS profile. Clive Watson makes an introduction to Templates and Profiles in his blog, but I just wanted to clarify a couple of things you need to have in mind before trying to make this work.

When you create a virtual machine based on a template the creation process includes a few additional steps:

On step 3 a Sysprep Virtual Floppy Disk is created, and then on steps 8, 9 and 10, that disk is attached, the VM is started and the disk is released. By then the VM should have been started and Sysprep'd, after which it is just shut down and ready to go.

Two important things you should consider for this to work are:

  1. When SCVMM starts the VM it doesn't just move on to step 10, it waits for a heart-beat. That means the image you use needs to have VM Additions installed first. Therefore a blank VHD will never work for this.
  2. SCVMM will not really Sysprep the machine, it will simply use the Virtual Floppy Disk to enter the guest OS profile as the Sysprep data. This means that the VHD will have to be Sysprep'd first by the Administrator, and that it should be ready to run fully automated, so that the OS can start and so that the VM Additions can send a heart-beat back to SCVMM. Jose Aguilar explains how to fully automate sysprep on his blog.

If your VHD is not pre-sysprep'd the virtual machine will still be created, but the guest OS profile will simply be ignored. The VM Additions are completely necessary, otherwise the creation process will fail.

Automating windows

25. September 2006 10:22 by smurillo in General  //  Tags:   //   Comments (0)

Do you ever find yourself doing repetitive tasks on your computer? When you are a developer and this happens to you, the tendency is to start thinking about how you can automate that task and if it's worth the effort. You could immediately start thinking about WMI or API's, but there could probably be a simpler and quicker solution, macros.

I remember using the discontinued Macro Recorder on Windows 3.1 and thinking how useful it was. Recently I found myself taking lots of screenshots and adding borders to them using Paint Brush (I know there are lots of image editing tools that could easily do that for me). When I had done it a few times I started remembering the old macro recorder and I thought it couldn't have helped me much on this.

I started looking for modern alternatives and found AutoHotkey and what a long way we've come. It's not just a recorder, you can automate all sorts of stuff, interact with windows and controls, wait for events and automate tasks through hotkeys and hotstrings. Best of all, you work with text scripts that you can edit manually and even compile them into executable files.

Since I have been working on the virtualization scenario for a while now I also think about the impact this can have in terms of virtual machines. For example, perhaps you could add startup scripts that will install applications that could not be included in the image for licensing reasons.

SCVMM on Domain Controllers

19. September 2006 09:34 by smurillo in General  //  Tags:   //   Comments (0)

While I was playing with System Center Virtual Machine Manager Beta 1 I bumped into a problem when I tried to add a second host. Since the Virtual Server service won't even start on a VM, you can't use a VM as a host; you depend on physical equipment to test SCVMM properly.

We are working with limited resources and the only x64 host available happens to be a domain controller. The other available host is a 32-bit computer, the one we are using to run SCVMM, which we are also using as a host. While trying to add the host we got the following error:

"Error (406) Access denied while contacting the virtual machine host x64svr0x.virtua"

At first we thought it would be a domain configuration problem, it wouldn't be terribly unusual. But everything else was working just fine so we started thinking about other theories. This is very normal for beta versions of a product.

After getting some help from the nice people at Microsoft, I can tell you that if you are having this problem and you are thinking of theories too, you should know that installing either SCVMM or host agent on a DC is not supported in beta1. Keep that in mind if you are testing SCVMM.

Expert's tips on SCVMM (Carmine)

11. September 2006 09:46 by smurillo in General  //  Tags:   //   Comments (0)

Clive Watson has been testing the new System Center Virtual Machine Manager Beta 1 and he has posted some articles about it on his Weblog. All of these parts together end up being a very nice user guide for this version of SCVMM:

Part 1: Introduction
Part 2: Host Groups and Self-Service policies
Part 3: Views for Hosts and Virtual Machines
Part 4: Adding a new Host
Part 5: Filtering views
Part 6: Host’s Managed Properties
Part 7: PowerShell
Part 8: PowerShell (cont’d)
Part 9: How to create a Virtual Machine
Extra: Can you help the help?
Part 10: Remote control
Extra: Summary and Diagram
Part 11: Template and Profiles

Extra: SCVMM Self-Service FAQ update

Since this is a Beta 1 version there is not a lot of documentation for you to start playing with it. Clive Watson has done a very good job on this, it’s really helpful and it can lead to a better testing of the product.

Detecting Virtual Machines

11. September 2006 05:09 by smurillo in General  //  Tags:   //   Comments (0)

I was a firm believer in the fact that an application could not for sure detect that it was running on a Virtual Machine. I had thought of things like checking if the VM Additions were installed, or checking if the hardware devices in the system matched those used by Microsoft's Virtualization products, but I still thought these techniques could not be conclusive enough, not beyond ALL reasonable doubt.

Then I decided to look for solid ways to detect if an application is running on a Virtual Machine. This could be helpful for example, if you want to release a time-limited trial version of an application you are developing and you want to restrict it from running on a VM.

Turns out if you check the motherboard on a Microsoft VM you are going to find that it was made by Microsoft. Since Microsoft doesn't really make motherboards (yet?), this is a clear indicator that you are in the presence of a VM. You can find a programmatic way to do this on Virtual PC Guy's Weblog. Of course if Microsoft decided in the future to start manufacturing motherboards your applications will refuse to work on some physical machines too :-)

I also found an interesting article on The Code Project website, that uses an exception method to detect a VM running on Virtual PC. And it also includes a technique for VMWare.

Turns out it is not impossible after all, there are plenty of ways you can find in the Web to detect when your application is running on a VM. Just be careful to choose one that is trust worthy and use it wisely.