ScorpioTek Solutions
07-filler-left Information about ScorpioTek Services Offered by ScorpioTek Training Courses Offered by ScorpioTek Technology Blog by ScorpioTek Contact us for more information on training/services 08-filler-right
06-message

Archive for May, 2010

HPC Server 2008 Heat Map Resuscitation with PowerShell

Monday, May 31st, 2010

Note: This script will work with PowerShell v1.0 and is slow.  If you would like a faster version and you are willing to upgrade your head-node to v2, check this post instead.

I’ve been working in creating a series of demos for a couple of HPC trainings we are delivering this month.  One of the things that I’ve noticed with the heat map, is that when restoring the nodes from a snapshot (they are virtual nodes) the heat map fail to display the info.  This is due to some services on the nodes not starting and failing to communicate with the head node.  The solution is to go through every node and restart this service.  Good luck doing that if you are running a 1,000 node cluster!

You might think “well, why not just use clusrun to stop and start the service?”  Thought of that and then realized that one of the services that need to be restarted is the one that is used for clusrun, so as soon as you shut it down, your clusrun session is over.

Once again, psexec and PowerShell save the day.  If you would like to restore heat map functionality from the head node to all nodes on your cluster, follow these steps:

  1. Download and drop a copy of psexec on c:\Windows\System32 on your head node
  2. Copy the PowerShell code below and save it in a file, say “C:\FixHeatMap.ps1″
    $HEAD_NODE = "HPC-HN"
    Write-Host "Setting Head Node To:" $HEAD_NODE
    Set-Content Env:CCP_SCHEDULER $HEAD_NODE
    
    $nodes = Get-HpcNode
    $services = "HpcManagement", "HpcNodeManager"
    
    foreach ($node in $nodes)  {
    foreach ($service in $services) {
    
    $serviceStart = "net stop $service"
    $serviceStop = "net start $service"
    $commandBytesStart = [System.Text.Encoding]::Unicode.GetBytes($serviceStart)
    $commandBytesStop = [System.Text.Encoding]::Unicode.GetBytes($serviceStop)
    $encodedStartCommand = [Convert]::ToBase64String($commandBytesStart)
    $encodedStopCommand = [Convert]::ToBase64String($commandBytesStop)
    $commandLine += $encodedCommand
    
    $computer = $node.NetBiosName
    $computer = "\\$computer"
    
    psexec $computer cmd /c "echo . | powershell -EncodedCommand $encodedStartCommand"
    psexec $computer cmd /c "echo . | powershell -EncodedCommand $encodedStopCommand"
    }
    }
    #Start the service that retrieves info from CN to heat-map
    net stop HpcSdm
    net start HpcSdm
    
  3. Edit the text of the file so that $HEAD_NODE = “HPC-HN” matches the name of your head node
  4. Open an HPC PowerShell command prompt and launch the script, here is the script in action with 4 nodes:

One of the things you will notice is that it can be slow as 3 services are started and stopped for every node via a remote call with psexec.  I know the process can be long but I don’t have time to optimize it.  If there are PowerShell gurus that would like to chip in, please be my guest!

Sources

How to get Server Core 2008 R2 to Hyper-V in 10 Minutes or Less

Tuesday, May 25th, 2010

Motivation

I need to showcase the capabilities of Windows HPC Server 2008 and for doing so I’ve decided to host 4 VMs that will be part of the cluster.  My VM server only has 4 GB of RAM and I need to make the best usage out of the hardware.  I decided to install Windows Server 2008 R2 Enterprise as the Server Core option, this would give me more RAM for the VMs to run. I wrote this guide to get your base Windows Server 2008 R2 installation to a full Hyper-V server in a matter of minutes, let me know if it works for you!

Procedure

One of the first things you want to do is enable remote desktop connections:

WMIC RDToggle Where ServerName="%COMPUTERNAME%" Call SetAllowTSConnections AllowTSConnections="1"

Then, enable the firewall to allow RDC:

netsh advfirewall firewall add rule name="RemoteDesktop" dir=in action=allow protocol=TCP localport=3389

That’s it in terms of sitting in front of your server core, you can now connect remotely and carry out the rest of the procedures.

If you have not done so already, log-in from a remote computer to your server core box.

Let’s now enable .Net 2.0:

dism /online /enable-feature /featurename:NetFx2-ServerCore

And now, let’s enable PowerShell:

dism /online /enable-feature /featurename:MicrosoftWindowsPowerShell

Download Core Configurator, burn it to a CD/DVD and insert it into the server core box.

Copy all the contents of the DVD to your server core machine, for instance:

xcopy /Y D:\* c:\Program Files\CoreConfiguratorv20\

Open PowerShell:

c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Enable RemoteExecution policy:

Set-ExecutionPolicy RemoteSigned

Change directories to the CoreConfigurator directory:

cd "C:\Program Files\CoreConfiguratorv20\"

Launch Core Configurator:

.\CoreConfig.ps1

Now on CoreConfigurator carry out these steps:

  1. Click “Computer Settings…”
  2. Click Roles and Features
  3. Enable the Hyper-V role and click Apply:
  4. You will be prompted to Reboot, click Restart now

    You machine will reboot and after configuring Windows will reboot once again

    You should now have a full Hyper-V Server Core installation, pat yourself in the back, you deserve it.  Now…how do you do stuff with it?  Well, first and foremost, CoreConfigurator has a Hyper-V settings button:

From that setting you should be able to start/stop VMs:

But what about controlling the Hyper-V settings from a Hyper-V manager from another machine?  The good news is that is possible, and the bad news is that is not straightforwards.  Luckily for us, John Howard was cool enough to write a utility that enables a much easier configuration: the Hyper-V Remote Management Configuration Utility

Read the instructions carefully and you should be able to control your Server Core Hyper-V from a remote Hyper-V machine:

How to use QuickSFV to verify file integrity

Saturday, May 22nd, 2010

We usually exchange large files with our customers, such as highly compressed virtual machines.  Compression works perfectly for us, as it allows us to send a VM as one file, which is usually a self-extracting archive.  However, downloading files opens up the possibility of download corruption, which can render the compressed archive useless.

In order to avoid corrupted downloads, you should use a download manager that allows you to resume the download in case it breaks.  We’ve had good luck recently with Internet Download Manager.

In order to verify that no corruption has happened during the transfer process, we usually send our clients a sfv file.  This file is intented to be used with QuickSFV in order to verify that the download is not corrupt .  The following guide will instruct you on how to use QuickSFV to verify that your download is not corrupt.

Assumptions

We are assuming that you:

  1. Already have the files downloaded somewhere on your computer
  2. Already have installed QuicSFV on the computer where the files were download (make sure you install the correct one if you are using a 64-bit OS)
  3. Have placed the sfv in the same folder where the files you want to check are located

Procedure

  1. Navigate to the folder where your downloaded files are
  2. Double click the sfv file
  3. QuickSFV will start checking your files.  Depending on the size of the files, this might take some time

    Verification in Progress

  4. If you see a dialog similar to the one below that displays All files OK, you are good, the files have been verified:

    Pass

  5. If you see the dialog below, pay attention to which file is corrupt and re-download the file:

    Fail

Parting Words

ALWAYS use a download manager for large files, you’ll be sorry if you stick to FireFox/Internet Explorer for these types of downloads.

Consider donating to QuickSFV, it’s a great utility that can save you hours of pain.

How to avoid duplicate messages in OS X Mail.app with Spotlight (Gmail)

Saturday, May 22nd, 2010

I love Spotlight in OS X, especially for finding that particular message.  Finding a message buried in thousands of mails can be as easy as typing into Spotlight some of the properties of the mail you are looking for.  If you use IMAP with Gmail, or IMAP with a domain of your own under Google Apps, you might notice that when you search for a mail, lots of duplicates can quickly pile up, which is truly frustrating:

Thanks, but no thanks!

I quickly got fed up with this and decided to look for a solution and fortunately there is one :)

The first thing you need to do is enable Labs for your Gmail account, this is simple and I found some instructions here.

Once you have enabled Labs, access the Labs tab and look for a lab feature called Advanced IMAP Controls:

Enable this Option

Enable this option

Once you have enabled the feature, make sure you scroll down and click the Save Changes button or nothing will be saved.

Almost there…now from your Gmail account, from Settings and then hit the Labels link:

You should now get a listing of the mailboxes that usually show up in Mail.  Un-check the one that is causing the duplicates to show up in Spotlight, which is usually the All Mail one.  As an extra, I like to uncheck the Spam folder as well, I really don’t go around looking for spam every now and then:

Close and reopen Mail.app, rebuild your Spotlight index and say goodbye to duplicate entries in your Spotlight results forever!

Sources:

http://www.macosxhints.com/article.php?story=200802081934189

SCVMM Extender Group Deployment Feature

Friday, May 14th, 2010

During the last few months we’ve been playing around with System Center Virtual Machine Manager (SCVMM) to deploy virtual machines for various lab configurations.  SCVMM is an interesting product. and while it lacks in some features, it gives you the ability of create anything you’d want it to be by exposing a PowerShell API.  By using this PowerShell API, we’ve been able to extend SCVMM for our particular needs and we’ve built the SCVMM Extender.  As of now, it is in very early stages, but it allows us to carry out “Group Deployment”, which is a real time saver in some lab scenarios.

For more info on this feature, check out the video below:

Adding Multiple Virtual Networks to Multiple Hosts in a Snap

Thursday, May 6th, 2010

Today I received a request to deploy 120 virtual machines in SCVMM, however these machines needed to be deployed in groups of 4 across in each host.  The real problem with this scenario was that none of the hosts had the virtual networks I required.  These VMs are part of  a Windows HPC Server demo and they required a combination of a public network, one internal network, and 2 private networks.  If you import into Hyper-V a VM export that does not have the exact name as the virtual network specified in the export, it will not be connected.  So if you deploy 1,000 machines and their networks are not set right, then you have to configure them manually…yeah…good luck.

What I did to solve this problem was to download the PowerShell Management Library and write the following lines of code:

Import-Module 'C:\Program Files\modules\HyperV'

$hostName = 'Pac07010'

New-VMPrivateSwitch "Application" -server $hostName

New-VMPrivateSwitch "Private" -server $hostName

New-VMINternalSwitch "Enterprise" -server $hostName

And that’s it.  I was lucky enough that my machines were named in consecutive order, so I just wrote a for loop to iterate through the machine collection.  I then sat back with a big smile on my face.  I have really not faced a problem that the PowerShell Management Library has not been able to tackle – thank YOU jamesone!



The Virtual PC Guy, Domain Controllers, and you

Thursday, May 6th, 2010

One of my favorite bloggers, Ben Armstrong, published an article entitled “Managing the Default Virtual Machine Location with Hyper-V“.  In this post I found one of the most valuable tips when working with domains and virtual machines.  Anybody who has ever dealt with DC can tell you that troubleshooting them can be a real pain.  Numerous times I have pulled my hair in frustration wondering why an HPC Cluster is not working right only to find that the domain was not being accessed correctly.  Ben writes in his post how to avoid this problem by modifying a registry key.

What good is this for?  Well, it’s a great way for you to know there is a problem before it explodes in your face in the worst possible time.  By following Ben’s advice, you’ll get an error message when the AD logon domain is not available.  Otherwise, your machine would join as if there was no problem at all, which could be really bad news for demos.