When you make a Virtual Server deployment, make sure that you follow Microsoft’s recommended Best practices for Virtual Server. They can improve the performance of Virtual Server installations, and make your life as a system administrator easier.
One important thing that many people overlook when creating multiple VMs is the importance of using Sysprep. I wrote a quick walkthrough here, and you can find documentation on Microsoft’s website about it as well. Sysprep makes sure that each cloned virtual machine will be unique – not using it may introduce security and performance issues in your network.
While trying to build a C++ application that tried to use the library from Virtual Server library VSComInterfaces.lib, we were getting a linker error that had us baffled for quite some time:
Error 1 error LNK2001: unresolved external symbol _IID_IVMVirtualServer EnumVMs.obj
Error 2 fatal error LNK1120: 1 unresolved externals H:\Virtua\M01\Exercise-6\VMListing\Debug\VMListing.exe
Searching for an answer in various search engines, only lead us back to where the example source code had originated:
http://windowssdk.msdn.microsoft.com/en-us/library/ms699581.aspxWe had no idea what was going on...we had brought the library from the C:\Program Files\Microsoft Virtual Server\Documentation directory from the server...the server...the
x64 server!!!!
A quick check using dumpbin displayed the following info on the lib:
FILE HEADER VALUES
8664 machine (x64)
3 number of sections
43589BDA time date stamp Fri Oct 21 00:42:18 2005
57D file pointer to symbol table
47 number of symbols
... We quickly compiled to 64-bit to see if the 64-bit library was indeed the culprit. The app compiled without any problems!!
Bringing over the 32-bt lib file from a 32-bit Virtual Server allowed us to create the 32-bit version of the application and everything is back to normal.
Hopefully someone will find this post if they ever encounter the same problem in the future.
This code allows you to retrieve the information for Virtual Server’s performance counters from C#. It reads both the Virtual Machines and Virtual Processors counters.
1: PerformanceCounterCategory vmCat =
new PerformanceCounterCategory("Virtual Machines");
2: PerformanceCounterCategory vpCat =
new PerformanceCounterCategory("Virtual Processors");
3: string[] vmInstances = vmCat.GetInstanceNames();
4: string[] vpInstances = vpCat.GetInstanceNames();
5:
6: List<PerformanceCounter> countersList =
new List<PerformanceCounter>();
7:
8: foreach (string instance in vmInstances){
9: PerformanceCounter[] counters =
vmCat.GetCounters(instance);
10: foreach (PerformanceCounter pc in counters)
11: {
12: countersList.Add(pc);
13: }
14:
15: foreach (string instance in vpInstances)
16: {
17: PerformanceCounter[] counters =
vpCat.GetCounters(instance);
18: foreach (PerformanceCounter pc in counters)
19: {
20: countersList.Add(pc);
21: }
22: }
23:
24: while (true)
25: {
26: System.Threading.Thread.Sleep(1000);
27: foreach (PerformanceCounter pc in countersList)
28: {
29: Console.WriteLine(
"{0}:\"{1}\" Counter:{2} Value:{3}",
pc.CategoryName, pc.InstanceName,
pc.CounterName, pc.NextValue());
30: }
31: }
When working with these labs, people who have heard about the hypervisor integration
usually ask what is going to be different between the hypervisor and the current offerings or Virtual Server 2005 R2 Beta. In this link, you an find extensive information about the difference between them, but of special interest is the table below:
|
|
Windows Server Virtualization
|
|
|
|
|
|
|
|
|
Yes, up to 8 processor VMs
|
|
|
|
Hot add memory/processors?
|
|
|
Hot add storage/networking?
|
|
|
Can be managed by System Center Virtual Machine Manager?
|
|
|
|
|
|
|
|
|
|
|
More than 64. As many as hardware will allow.
|
|
|
|
This table only goes to show that Microsoft’s Virtualization strategy in the future will offer a lot more than Virtual Server. Keep in mind that these features will be available about 180 days after Windows Longhorn Server ships, so until then, we will just have to sit back and watch these long awaited features with a lot of patience.
Another virtual machine product that has been making a lot of noise lately is Xen, the open source project from Xensource. Xen uses a different approach to virtualization than Virtual Server, called Paravirtualization. In this type of virtualization, the guest OS has to be modified to work with a software interface to the Virtual Machine Monitor, instead of thinking it is running on the hardware. The thing is that this actually enables better performance of the Guest OS, as it aware that is running on a virtual machine environment. Xen also supports running unmodified OSes, but for that it is mandatory to have hardware virtualization (VT-x on Intel or SVM on AMD CPUs).
The next releases of Windows Virtualization are implementing a similar approach. It will still be pure virtualization, but the Guest OS will also be enlightened. What this means is that the Guest OS will be aware that it is running on a VM, so it will be able to increase the performance using a modified kernel. The best part about all this is that Microsoft and Xensource are actually working together to make sure that the technology included with Windows Virtualization will be compatible with the technology used in Xen. So, at the end, we, the customers, win.
If you would like to edit XML files in Visual Studio and use intellisense, this is what you have to do:
Locate your schema, then copy it to C:\Progam Files\Microsoft Visual Studio .NET 2003\Common7\Packages\schemas\xml.
Then open your XML document and reference the schema by its namespace URI in the root element.
If you want to automate the update of your schema files the use scripting on the Visual Studio's OnStartupComplete event.
We at the virtualization team, have been creating copies of a virtual machine to use them as workstations that will be grouped into a domain. The only problem is that the original virtual machine was not syspreped and apparently this is creating problems joining the domain; this can be seen when new users can not log in the new virtual machine.
One quick and easy way that we have found helpful to fix this is changing the name of the computer (to avoid the duplicated name) and moving it to a temporary workgroup at the same time (we couldn't get to rename otherwise). Then we just made the computer reboot, and then moved it back to the domain, and reboot again. After that, it worked just fine.
When you are creating scripts to be executed by the Windows Scrip Host, you know there are two applications that could host your script: WScript which is a GUI host or CScript which is a console based host. By default Windows uses WScript, but you can change the default host with a simple command wscript //H:WScript will set WScript to be the default host, and wscript //H:CScript will set CScript to be the host.
But what happens if you don't want to get such an ultimatum for all of your scripts. Wouldn't it be nice if you could make your script choose it's own host? I asked my self that question and found this VBScript code online (I couldn't find the original source):
' Forces this script to be run under the desired scripting host.
' Valid sScriptEng arguments are "wscript" or "cscript".
' If you don't supply a valid name, Force will switch hosts.
Sub Force(sScriptEng)
If Lcase(Right(Wscript.FullName, 12)) = "\wscript.exe" Then
If Instr(1, Wscript.FullName, sScriptEng, 1) = 0 Then
'Need to switch to CSCRIPT
CreateObject("Wscript.Shell").Run "cscript.exe " & Chr(34) & Wscript.ScriptFullName & Chr(34)
Wscript.Quit
End If
Else
If Instr(1, Wscript.FullName, sScriptEng, 1) = 0 Then
'Need to switch to WSCRIPT
CreateObject("Wscript.Shell").Run "wscript.exe " & Wscript.ScriptFullName
Wscript.Quit
End If
End If
End Sub
All you need to do is call this procedure at the beginning of your script and it will be ready to go. So, for example:
Force "cscript"
will force your script to run on the CScript host. A wrong parameter will just force the script to run on the opposite host.
Set your scripts free!
It is a well known fact that dynamic VHDs that reach their limit cannot be made any bigger when running in Virtual Server. I recently stumbled onto this problem when creating a differentiating disk from a base install of a dynamic disk of Win2K3 with 2 GB tops space. I had two choices at this point:
- Create a new VHD and install everything I had done
- Try to find a way to expand the VHD with whatever hack came to my mind.
Being the stubborn person that I am, I decided to follow the latter.
The good news is that i t can be done - the bad news is that it may be a bit of an overkill! Anyhow, here is what you need:
- A BartPE ISO that has some kind of imaging utility (ours has Ghost and TrueImage - amazing programs!)
- A fixed empty VHD that will fit the image of the disk you are trying to expand
- Lots of patience
Step 1: Image the Image- Add the BartPE.iso as an additional CD-ROM Drive
- Add the empty VHD (let's call it images.vhd) as an additional VHD
- Boot your PC, it should boot from the CD and Bart-PE should start
- Format images.vhd into an NTFS drive using whatever you want
- Create an image of your source disk (the one you are trying to expand) and place it on the images drive
Step 2: Restore the Image- Create a new VM configuration with a new VHD that will hold the new size (format it as NTFS with any utility you like)
- Add the BartPE.iso as an additional CD-ROM Drive
- Add the images VHD as an additional VHD
- Boot your PC, it should boot from the CD and Bart-PE should start
- Use Ghost or whatever you want to restore from the Image from the Images.vhd
Reboot. Enjoy!
Checking ScottGu's Blog the other day, he pointed to some useful links, I specially like the UrlRewriting library, I'm considering using it so wait for updates for my experience with it. I recommend to check that library it looks really good.
Via ScottGu's Blog
UrlRewritingNet.UrlRewrite V2.0 Released: Albert Weinert sent me mail on Friday pointing me at the new release of the UrlRewriting engine that he and Thomas Bandt wrote for ASP.NET. It is available as a free download and includes samples + full source code.
The Windows Live team recently launched the Live Writer tool for writing blog posts. This is a sample post made with the tool. So far, it looks nice, with most features already working.
One of the nicest features is Live Map integration:
San Jose, Costa Rica
I think I am going to stick with Blogjet for the time being (especially for the flickr integration). But it won't harm you to check out Live Writer as well.
Without a doubt, Virtualization is
the tech buzz word for this year. Every newsletter I receive has a link to at least 3 VT sites. Recently I stumbled on
this entry which is a podcast by
Dean Wells, who does a great job explaining what IT should consider nowadays when making computer purchases.
I think many IT departments are blindly making purchases of hardware that do not support VT technology. What they don't know is that the moment they purchase this new equipment, they are pretty much buying outdated equipment. Mr. Wells does an amazing job explaining what IT departments should strive for when making these types of decisions, it is definitely worth a listen.
I have to admit I was a bit shocked when I tried to copy and paste text between VMs using Virtual Server. The clipboard was not copied at all and there was no easy way to transfer text back and forth. I tried installing the Virtual PC Additions and still no luck. I could not believe they left out a feature like this one out - I don't know if enabling this is trivial using some super secret setting, but until then, here is a workaround.
It is actually quite simple, and it was
Stephen who hinted me on this while I was ranting. On the host machine, enable Remote Desktop Connections and connect using a RDC client. You will be connecting to the VM just like any other mahine, and RDC supports copying and pasting of text back and forth.
Not the best solution, I know, but it gets the job done. It is also worth noting that the same problem happens with VMWare's VM player.
We, here at the virtualization team, have been digging around and testing some of the development options you have for the automation of virtualized environments.
Developers might be waiting for that famous Microsoft Hypervisor that will be available with Windows Server "Longhorn". In the meantime, there are still tools you can use. The Virtual Server COM API is one of them.
You can instantiate this object on a local server where Virtual Server is up and running and you can then have access to its properties and procedures. But if you want to develop something a bit more dynamic you might be interested on creating a centralized management tool for a group of Virtual Servers. This can be accomplished by initializing the Virtual Server Object remotely. Learn more about this by accessing the Virtual Server Programmers Guide, included in your Virtual Server installation.
What I want to point out on this entry is that if you are planning to use the remote access, beware you are going to need your Virtual Server on the same domain where the application is running, or as a difficult alternative you can set up a trusted link. Also, the user executing the code must be added to the Administrator's group on the remote Virtual Server. Failing on doing this will lead to runtime security issues that will simply prevent the object from having access to the remote server.
This code snippet allows you to connect to a remote instance of Virtual Server 2005 R2, via WMI, and retrieve all the Virtual Machine WMI objects.
1:
2: System.Management.ConnectionOptions co =
3: new System.Management.ConnectionOptions();
4: co.Username = user;
5: co.Password = password;
6:
7: ManagementScope scope = new ManagementScope(
8: new ManagementPath(@"\\"+computer+
@"\root\vm\virtualserver"),co);
9:
10: scope.Connect();
11: SelectQuery oq =
12: new SelectQuery("SELECT * FROM VirtualMachine");
13:
14: ManagementObjectSearcher searcher =
15: new ManagementObjectSearcher(scope, oq);
16:
17: foreach (ManagementObject queryObj in searcher.Get())
18: {
19: //Do something
20: }
You need to provide a user and password with enough credentials to query the Virtual Server instance.
BTW, if you ever need to format your code for display on the web, check out this website.
What?!? Kill VPC? A few weeks ago they announced they would give it away for free and now they are ceasing production...does not make sense, does it?
Well, if I add a "for Mac" at the end of the my Blog title it probably makes a lot more sense, doesn't it? ;) Today the Mac community learned the pleasant surprise that
VMWare is going to be releasing a Virtualization solution for Intel Macs. On the same day, we also find out that Virtual PC for the Mac is going bye-bye :(
While this means that many PPC Macs will be left out in the cold without a way to emulate Windows, I understand where Microsoft is coming from. Catching up where
Parallels is right now in terms of VT support on the Mac would really take a while, and they would basically be starting from square one. I can't wait to see what VMWare has up their sleeve...beating
Parallels in the Virtualization market on Intel Macs is certainly a tough challenge.
One nice features of the JLCA is that it converts javadoc-style comments into the corresponding .NET XML comment. Well, a new tool was released a few weeks ago that can take .NET’s XML documentation and create nice looking files. It is called Sandcastle, and is currently a CTP download. It can create .html files from the source code, which can be processed with the HTML Help Workshop to generate a .chm file. It also has a Visual Studio Add-in that makes the process really easy.
You can download the CTP here, and read all about it in the Sandcastle team blog.
“Carmine” (System Center Virtual Machine Manager (SCVMM) Beta 1) is available for download! You first need to register for the beta at http://connect.microsoft.com, and then login into http://connect.microsoft.com/vmm/downloads with your passport Id.
I just finished downloading it and will start playing with it soon. Too bad that calling into VMM from Powershell and the functionality to convert from a physical machine to a virtual machine are not included in this beta.
Some people here in Artinsoft is doing a great deal of work around virtualization. You should check out their posts.
I was preparing a test environment for an application and I needed to run my check in tests in several versions of windows and I found this article
which has been of great help for me in setting up a virtual test lab. I really recommend it. After you read it you will figure out great new test environments.
Like database tests. where you setup a virtual disk with your database, or diferrent images with diferent driver versions.
Good Luck!