Playing with Sandcastle

28. June 2007 06:44 by Jaguilar in General  //  Tags:   //   Comments (0)

Some time back I blogged about the Sandcastle project over at Microsoft, a tool that allows you to generate MSDN-style documentation from the comments in the .NET code (among other things). I recently downloaded the Sandcastle - June 2007 Community Technology Preview (CTP) to generate some documentation for a project we did with the HPC team at Microsoft. Even though it is still a CTP, it works great – right now I am able to add comments to the code and then generate sufficient documentation semi-automatically, killing two birds with one stone.

If you are interested in using this tools, make sure to check out post Creating a Chm build using Sandcastle at the Sandcastle blog . Remember that Sandcastle will extract and transform the comments from your files, but you still need the HTML Help Workshop to create the actual *.chm file.

Changing the login authentication mode for SQL Server Express 2005

24. May 2007 10:10 by Jaguilar in General  //  Tags:   //   Comments (0)

Here’s another time-saving tip. If you select Windows Authentication when installing SQL Server Express 2005, and you need to change it so it allows SQL Server Authentication later on, all you need to do is change a registry key. To do this, shutdown all SQL Server-related services, run regedit32, and in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer, change the value of LoginMode to 2.

Restart all services, and that should do the trick. You can get more information in this KB article (talks about MSDE/SQL Server 2000, but it also applies to SQL Server Express).

Assigning Computer Names to Windows 2003 installations when using WDS

23. May 2007 16:03 by Jaguilar in General  //  Tags:   //   Comments (0)

Here’s a tip that should save you some time (I spent several hours trying to figure this one out). When you deploy a .WIM image with Windows Server 2003 using WDS, you can have that machine take on the name you gave to it in Active Directory (when prestaging the computer). To achieve this, do the following:

  1. Create a copy of the sysprep.inf file on the folder c:\RemoteInstall\Images\\\$OEM$\$1\Sysprep
  2. Edit this sysprep.inf file and make sure you have the following lines in place:



  3. Remove the file c:\Sysprep\sysprep.inf from the image (if necessary, mount it with imagex)
  4. The next time you re-image the machine, the WDS client will place this sysprep.inf file inside the image, and will grab the name you gave to the machine in Active Directory when you prestaged it.

Changing the PXE ROM Boot Program for a Specific Machine with WDS

16. May 2007 10:42 by Jaguilar in General  //  Tags:   //   Comments (0)

You can specify the rom boot program to use with a specific machine when using WDS. This allows you to set the machines to always try a PXE boot first, and control its behavior from WDS.  WDS comes with three x86 boot roms, each with different functionality (this also applies to x64 and Itanium – since I only have x86 machines available for testing, I’ll use those roms):

  • Boot\x86\ Normal boot ROM. It presents the prompt for F12 and boots from WDS ONLY if F12 is pressed
  • Boot\x86\pxeboot.n12: Boots directly from the network (PXE) without waiting for F12 to be pressed
  • Boot\x86\ Aborts the PXE boot process and continues booting from the next boot device

In order to change the boot rom, you need to have the machine pre-staged in Active Directory, and use the wdsutil command line program. You also need to know either the name or the MAC address of the machine. With that information, you can issue the command:

      wdsutil.exe /set-device /Device:SERVER01 /BootProgram:Boot\x86\pxeboot.n12


      wdsutil.exe /set-device /ID:AA-BB-CC-DD-EE-FF /BootProgram:Boot\x86\pxeboot.n12

The previous lines change the boot rom to pxeboot.n12 of the machine SERVER01.

By using this, when you have to restore an image to a machine, you can just change the boot rom to pxeboot.n12, and the process will take place automatically (depending on how you have it configured). Once it is restored, you can change it back to, and it will continue booting from the hard drive every time.

SCVMM Beta 2 first impressions

8. May 2007 00:08 by Jaguilar in General  //  Tags: ,   //   Comments (0)

Today I finally got a chance to play with Beta 2 of the System Center Virtual Machine Manager. Here are my preliminary impressions:

  • First of all, the product has improved significantly. It has tons of new features, and uses tons of new pre-requisites. Fortunately, you can download a pre-configured VHD with SCVMM, ready to go, from Microsoft Connect.
  • This version of SCVMM uses the new Windows Remote Management (WinRM) package to manage remote servers. This is a step in the right direction, IMHO, since it is Microsoft’s implementation of the WS-Management Protocol. The downside is that I had to install the WinRM package on the servers, but well, its a nice trade-off for getting a SOAP-based, standard management product.
  • One thing I really like about it is the Powershell integration. It is finally included in this version of SCVMM, and the implementation rocks – at the end of most wizard, you get a button that says “View Powershell Script”:
    Pressing that button shows you the Powershell script equivalent to the options you selected:

So far I’ve only been able to add hosts and manage the virtual machines on those hosts. I am looking forward to working with the new advanced features, including (and especially) the physical to virtual migration. Overall I think the new features are great, and you should give it a try.

WinPE 2.0: Lessons on capturing images

25. April 2007 15:33 by Jaguilar in General  //  Tags:   //   Comments (0)

This past two weeks I have been working on a deployment that involves technologies like PXE, WinPE, Windows Deployment Services, the Windows Automated Installation Kit, and others. I was stuck for a while with WinPE, having issues when trying to capture a Windows image using the WDS Capture disk.

Most of the issues I had were driver-related. When I started, neither the network nor the hard drive of the machine (SATA drivers!! argh!!) were available to WinPE.

So, I did the following:

  1. Get the storage drivers from Intel’s website. You can download them from here. Make sure you download the Vista version of the drivers.
  2. Unpack them on a temporary directory. In my case I ran:
             iata621_enu.exe -A -PF:\intel
  3. Mount the Capture WinPE 2.0 wim image (generated through the WDS console) to a directory:
             imagex /mountrw d:\temp\capture.wim 1 d:\temp\wpe
  4. Copy the file C:\Program Files\Windows AIK\Tools\x86\imagex.exe to d:\temp\wpe or where you mounted the wim image).
  5. Now, add the drivers to the WinPE image with the following command:
             peimg PF:\intel\*.inf d:\temp\wpe\Windows
  6. Unmount the WinPE wim image:
             imagex /unmount /commit d:\temp\wpe
  7. Add the WIM image to WDS. On the console, select Windows Deployment Services->Servers->->Boot Images->(Right Click)->Add Boot Image, and browse to the WIM you just unmounted
  8. Boot the target machine using PXE and make sure it loads the correct WIM image
  9. Ok, so here is where I had issues:
    • First, the WDS Image Capture Wizard didn't list the SATA drives. Turns out the driver loaded correctly, but for some reason it couldn't see the drive.
    • If you run into an issue where the driver won't load, try using the drvload command from the WinPE command prompt..
  10. Because of those issues, I had to fall back to the command line. To do this, press Shift-F10 in the Capture Wizard, and that will open a command prompt.
  11. Once in the command prompt, create the image using imagex:
             imagex /capture c: c:\myimage.wim "My Image" /compress maximum
  12. With the image created, map a network drive on the server, and copy it back:
             net use i: \\\share * /user:
  13. Copy the image back to the server (I: drive)
  14. Turn the machine off.
  15. Enjoy your newly captured image!!!!

Spring Cleaning or How to Optimize the Performance of Your PC Using a Free Tool

20. April 2007 04:53 by Jaguilar in General  //  Tags:   //   Comments (0)

Ever since we saw this post over at the Virtual PC Guy’s Weblog, we have been using Dave Whitney's Free Defragmenter on our virtual machines’ dynamic VHDs to improve the compaction process. The results so far have been great – we have managed to shrink dynamic VHD files to levels far beyond what we could with the standard Windows Disk Defragmenter.

This week I decided to do a little spring cleaning on my work laptop. I installed Windows on it around 2 years ago, and have been installing/uninstalling tons of software ever since. The machine, predictably, had become painfully slow.

Yesterday I managed to remove about 3.5GB of old software and files, leaving the hard drive horribly fragmented. So I decided to leave the Whitney’s defrag tool running overnight… today in the morning I am surprised on how responsive it is! Outlook now takes a few seconds to startup (with a multi-GB pst file), compared to over a minute yesterday. And I can’t believe how quickly the Windows Live Messenger and Visual Studio .NET 2005 started up. I was so surprised, I even decided to write about it here!

HOT TIP: I also recommend an utility called CCleaner to help you optimize your system. It removes all sorts of temporary files and safely cleans up the Registry. I my laptop it freed up around 750MB!

NTBackup and Acronis TrueImage Server VSS troubles

1. February 2007 14:40 by Jaguilar in General  //  Tags:   //   Comments (0)

Today I decided to test out the Volume Shadow Copy (VSS) support in Virtual Server 2005 R2. In theory, as I mentioned in an earlier post, with VSS, virtual server can create a consistent “snapshot” of a running virtual machine so other applications, such as backup clients, can use that snapshot without interrupting the virtual machine itself.

The only VSS-aware backup application I had installed was Windows’ very own NTBackup. So, I enabled VSS on the volumes, run NTBackup, and proceed to make a backup of my virtual machine. Everything started out OK, until NTBackup got stuck with the message “Waiting to retry shadow copy…”. Following my standard error-solving checklist, I checked the Event Viewer, and I found this message logged:

Volume Shadow Copy Service error: Error calling a routine on the Shadow Copy Provider {f5dbcc43-b847-494e-8083-f030501da611}. Routine details BeginPrepareSnapshot({f5dbcc43-b847-494e-8083-f030501da611},\\?\Volume{0cb1b616-8ea6-11db-88de-806e6f6e6963}\) [hr = 0x80070002].

We use Acronis imaging solution for deploying our server, and it turns out that Acronis’ VSS Provider has an issue with Microsoft’s VSS provider. Apparently the issue is well-known, and is documented in two forums posts. It is solved in the latest version of Acronis’ products, but I didn’t really had time to perform an upgrade (and Acronis’ products are notoriously stubborn when you try to uninstall them). So, I applied the solution suggested in one of the forum posts. I unregistered Acronis’ VSS provider using the command:

regsvr32 /u \windows\system32\snapapivss.dll

After that, the backup went without problems:


Opening up the log once the backup is complete shows you that all files from the virtual machine were backed up succesfully:


 This was done without turning the virtual machine off, taking advantage of the VSS functionality in Virtual Server 2005 R2 SP1 Beta. I performed the same operation on a Windows XP box, disabling NTBackup’s VSS support, and the backup predictably failed.

Here’s some information on VSS: Volume Shadow Copy Service (VSS)

Evaluation version of Windows 2003

31. January 2007 10:17 by Jaguilar in General  //  Tags: ,   //   Comments (0)

All of you are probably aware that you can download MSDN Pre-Configured Virtual Machine Images and of configurations you can get with the VHD Test Drive. There is another option, though, if you want to evaluate a Windows 2003 R2 installation by itself on a virtual machine or as a host for Virtual Server 2005 R2. You can get a 180–day evaluation of Windows 2003 Server R2 at the trial software page over at Microsoft. This makes it easier to evaluate the performance of the server product, for virtualization, or for any other tasks that you may be considering it.

Link: Windows Server 2003 R2: How to Get Trial Software

Moving a VMDK with Linux installed to a VHD

23. January 2007 09:44 by Jaguilar in General  //  Tags: ,   //   Comments (0)

As suggested in this post by Christian, I went ahead and downloaded the vmdk2vhd utility to convert virtual hard drives from VMWare’s VMDK format to Microsoft’s VHD format. To test it out, I also downloaded Red Hat Enterprise Linux trial virtual appliance from VMWare’s site, and ran the converter on it. These are my results.

First, running the converter is pretty straightforward. You just launch the utility, and it presents you with a simple UI, where you select the vmdk you want to convert, and the path to the destination VHD.


Once you select the vmdk and the vhd, press the convert button to start the conversion process:


The tool shows you a dialog box when it completes the conversion:

I created a new virtual machine in Virtual Server 2005 R2 SP1 Beta 2 using this newly converted VHD,  and, not knowing what to expect, I started it. The redhat OS started the boot up process normally:


After making some adjustments to the configuration, including the X Server configuration, I finally got the X Windows server to come up. I am currently playing with the OS, and will proceed to install the VM Additions … I will document the process in another post soon.


As you can see, the process for converting a VMWare virtual hard disk to a Virtual Server VHd is very straightforward. This will work, ideally, in a migration scenario, but this also enables a scenario to try out the large amount of Virtual Appliances that you can download from VMWare’s website.

Getting started with Powershell

4. January 2007 12:39 by Jaguilar in General  //  Tags:   //   Comments (0)

This week I finally manage to sit down and start using the 1.0 release of PowerShell. So far I’m impressed with its capabilities and ease of use. Here are a couple of tips to get you started with PowerShell scripting:

The commands in PowerShell follow the format verb-noun. It is very easy to “guess” a command once you’ve been using PS for a little while. To get the processes on the system, for example, you use the command get-process. To get the contents of a file you use get-contents -path . An so on.

So, guess what command is used to get help? Too easy, isn’t it? get-help is your greatest ally when working with PowerShell. If you are unsure of what a command does or how it works, you just need to invoke the get-help command, followed by the name of the command:

 PS C:\> get-help get-process


    Gets the processes that are running on the local computer.

Also, get-help supports wildcards, so you can use it to search for commands (in case you’re not 100% positive on the exact command name). So, for example, you can do a:

PS C:\> get-help get-*

Name                                 Category                                Synopsis
----                                    --------                                --------
Get-Command                    Cmdlet                                  Gets basic information about cmdlets...
Get-Help                             Cmdlet                                  Displays information about Windows P...
Get-History                         Cmdlet                                  Gets a list of the commands entered ...

Script Security
PowerShell scripts have the extension *.ps1. To execute scripts, you need to do two things:

  1. Enable script execution. This is achieved with the command Set-ExecutionPolicy. To learn more about this command, you can type:
  2. PS C:\> get-help set-executionPolicy

  3. Enter the path to the script. If it is in the local directory, enter .\.ps1. If not, enter the fully qualified path.

Scripting in PowerShell is very easy – the syntax is very C#-like, and it has the power of both the .NET Framework AND COM objects at your disposal.

Use .NET Data Types
PowerShell is built on top of the .NET Framework. Because of that, you can use .NET Data Types freely in your scripts and in the command prompt. You can do things like:

PS C:\> $date = new-object -typeName System.DateTime
PS C:\> $date.get_Date()

Monday, January 01, 0001 12:00:00 AM

Further help
Some great places to get you started with Powershell are:

Windows PowerShell Team blog
Technet’s PowerShell Scripting Center
Just PowerShell it
PowerShell For Fun

Don’t forget to get the Windows PowerShell Help Tool, for free, from Sapien’s website.

And don't forget the Assessment Tool!!!

23. November 2006 12:34 by Jaguilar in General  //  Tags: ,   //   Comments (0)

Yesterday I blogged about the Code Advisor, that will pinpoint common programming practices that difficult the migration of a VB6 application. Well, another very important tool that you can add to your arsenal is the Visual Basic 6.0 Upgrade Assessment Tool. This tool was developed by ArtinSoft, and creates a spreadsheet with detailed information of actual upgrade issues that will be present in the .NET code after the migration.

This tool is also a free download from Microsoft’s website. You can also check out ArtinSoft Visual Basic to .NET page for more information on upgrading Visual Basic 6.0 applications.

Remeber the Code Advisor!

23. November 2006 12:02 by Jaguilar in General  //  Tags: ,   //   Comments (0)

If you are considering to upgrade your Visual Basic 6.0 application to Visual Basic .NET or C#, remember that the recommended first step is to run Microsoft’s Code Advisor. The Code Advisor, according to the website:

The Code Advisor for Visual Basic 6 is an add-in used to review your code to ensure that it meets predetermined coding standards. The coding standards are based on best practices developed by Microsoft to produce robust and easy-to-maintain code.

The Code Advisor detects issues that are not converted automatically during the automatic migration, increasing the manual work required after running the conversion tools. These include Variant variables, late binding, soft binding of different objects, and others.

Check it out: Code Advisor for Visual Basic 6.0

Multicore lab Thread Checker mystery error... solved!!

9. October 2006 04:08 by Jaguilar in General  //  Tags: ,   //   Comments (0)

Some of you may recall that on some events, we got an error message on Intel Thread Checker during the Multicore lab. No matter what we did, even if we solved all the concurrency issues related to our code, the Thread Checker would always log this message:

Write -> Read data-race Memory read at [PrimesInstrumented.exe, 0x2468] conflicts with a prior memory write at [PrimesInstrumented.exe, 0x16816] (flow dependence)

During the labs, we have said that we've been working out the solution with the Intel support people - and now we have an answer!!The thing is that you can work with Thread Checker in two ways:
  1. Use compiler based instrumentation. With this, you basically need to add the /Qtcheck flag to the compiler command line to instrument the binary. Once it is instrumented and you run it, it will create a file called "Threadchecker.thr", that you can then load in the VTune Thread Checker. To do this, you need to use the following command lines: (using the primes example from the lab)

    icl /c /Zi primes.cpp /Qopenmp /Qtcheck /Od
    link primes.obj /out:PrimesInstrumented.exe /fixed:no /DEBUG

  2. Use Thread Checker to intrument the application. In this scenario, you don't intrument the binary at compile time, but have Thread Checker intrument it when running the application. For this, you need to build the application with the following command lines:

    icl /c /Zi primes.cpp /Qopenmp /MD /Od
    link primes.obj /out:PrimesInstrumented.exe /fixed:no /DEBUG

    And then load it in Thread Checker.

The error we were doing on the lab is that we were using both compiler and "Thread Checker" instrumentation, and that caused Thread Checker to report conflicts that are outside of the program and in the runtime libraries. Now, using either option (BUT not both at the same time) the strange error is gone!

Thanks to Vasanth Tovinkere at Intel who really helped us out with this problem!!

BTW, this is repeating an old blog post I did for the 64–bit Advantage Blog. The post was deleted for some reason. Since I consider this information to be important, I am re-posting it here.

OpenMP on Visual Studio

5. October 2006 08:57 by Jaguilar in General  //  Tags: ,   //   Comments (0)

You can create C++ application in Visual Studio that use OpenMP. When you run an application created with OpenMP and VS.NET, however, you may get this annoying error message: “This application has failed to start because vcompd.dll was not found. Re-installing the application may fix this problem.”:


When we tried this, we were puzzled by this error message, especially since it works with the Intel Compiler flawlessly. Well, it turns out that you need to include omp.h in your files ALWAYS when you use OpenMP from Visual Studio. This is not required on other compilers if you’re only using the OpenMP pragmas, but it is an issue with Visual Studio.

Thanks to Kang Su for pointing this out in his blog – I was going crazy trying to figure out what was wrong.

Also remember to enable OpenMP support in the C++ Project properties. This setting is in Configuration Properties->C/C++->Language->OpenMP Support.

OpenMP is your friend

4. October 2006 08:42 by Jaguilar in General  //  Tags: ,   //   Comments (0)

OpenMP is very easy-to use API that you can use to very rapidly add multi-threading to your C/C++ applications. OpenMP allows you to parallelize the execution of a region of code by just adding a few pragmas to the code. For example, take this code:

   for(int i = 0;i<=100;i++){
       a[i] = a[i]*10;

The code above performs a for loop sequentially. Since each iteration could be executed independently, we can easily add multi-threading to the application by adding these simple pragmas:

#pragma omp parallel for
   for(int i = 0;i<=100;i++){
       a[i] = a[i]*10;

The omp pragmas tell the compiler to generate code to parallelize the execution of the for loop. That means that if you run this code on a 4 core machine, it will create 4 threads, and each one will execute 25 iterations of the loop. Just by adding those pragmas, you now have a multi-threaded application that takes advantage of multi-core systems.

Yes, it's that simple.

Sysprep on Windows XP

26. September 2006 12:31 by Jaguilar in General  //  Tags: ,   //   Comments (0)

A while back I documented the process for doing a Sysprep on a Windows 2003 installation. Well, that same process works for a Windows XP installation. The sysprep GUI on Windows XP is slightly different, but you only need to make sure that the “MiniSetup” and “Pre-Activate” options are selected before pressing the Reseal button and shutting down the machine.

Here are the instructions to run Sysprep on Windows 2003.

Visual Studio unattended install

4. September 2006 14:55 by Jaguilar in General  //  Tags:   //   Comments (0)

If you ever do a Visual Studio .NET 2005 unattended install, you’ll notice that the installation reboots the machine several times and won’t continue until you log back in – defeating in part the purpose of the UNATTENDED install.

Well, this page over at Aaron Stebner's WebLog has some instructions that can help you make your installation REALLY unattended. It requires two things: first, remove some pre-requisites that end up on the vs_2005.ini files regardless of what you do (instructions here), and second, create a batch file that installs both the prerequisites and VS.NET. This is the code in the batch file for the unattended install on x64 boxes (run it from the VS dir):

wcu\msi31\WindowsInstaller-KB893803-v2-x86.exe /quiet /norestart
wcu\dotNetFramework\x64\netfx64.exe /q:a /c:"install.exe /q"
wcu\DExplore\DExplore.exe /q:a /c:"install.exe /q"
setup\setup.exe /unattendfile vs_2005.ini

For other machines, you may need to change the architecture of the .NET framework for the correct one (x86/x64). I made that batch file for an unattended install a few months ago at a 64–bit event where I had to install Visual Studio in around 30 machines, and it worked like a charm. YMMV

Vista RC1 Completed

1. September 2006 13:09 by Jaguilar in General  //  Tags: ,   //   Comments (0)

Windows Vista RC1 was completed today. From the Windows Vista Team Blog:

It’s official — Windows Vista RC1 is done!
You’ll notice a lot of improvements since Beta 2. We’ve made some UI adjustments, added more device drivers, and enhanced performance. We’re not done yet, however — quality will continue to improve. We’ll keep plugging away on application compatibility, as well as fit and finish, until RTM. If you are an ISV, RC1 is the build you should use for certifying your application.

Right now it is only available for customers on the TAP program, but according to a post in the forum, they plan to make it available to MSDN and Technet subscribers.

Live Writer sample post

15. August 2006 06:44 by Jaguilar in General  //  Tags: ,   //   Comments (0)

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.