Free VMware training!!!

April 21, 2011 Leave a comment

Well . .some free training . . and no . . not VCDX or anything too exciting, but VMware have at least provided some online training / eBooks to help all those people who will soon need to transition to ESXi, from ESX (ESX of course will be end of lifed soon)

On VMware.com blogs:

Great news for all VMware customers: the VMware Education Services team has just made available a new, FREE elearning course dedicated to ESXi , “Transition to ESXi Essentials”. The course is a self-paced three-hour online training that provides the knowledge necessary to make fundamental design decisions to successfully add VMware ESXi to a vSphere environment and to take advantage of all of the new features included in ESXi 4.1. The training is ideal for system administrators, consultants and engineers responsible for managing and supporting a vSphere environment.


More here . . .

Troubleshooting VMware issues with MindMaps

April 7, 2011 Leave a comment

The guys on VMTN have released a few new mindmaps to help with various bits of troubleshooting.
Initially, I thought, great, another flowchart . . but I run a few scenarios through my lab, thinking that instead of troubleshooting myself, I would simply follow the mind map and I was surprised at how well they cover the kind of problems we see both regularly on our various environments and also how well they cover issues that I regularly see on the VMware communities site.

Oddly, I had never spotted these before – but it seems there are a bunch available at http://communities.vmware.com/community/vmtn/general/knowledgebase?view=documents

Below are the 4 that I figure are going to be most pertinent in current environments – a very hany tool indeed.

Mindmap – vSphere Troubleshooting Network Issues
Mindmap – vSphere Troubleshooting Management Issues
Mindmap – VMware Troubleshooting View Management Issues
Mindmap – VMware Update Manager Issues

What I really like about these is not simply that they produce a ‘flow chart’ for troubleshooting, but the fact that once you get to the lowest level on the mind map, there is a little infinity sign that you can click on – which takes you to a knowledge base article for each solution. this means that just about anyone, no matter what their level, can use these

Categories: VMWare Tags:

Installing VMware SDK with Visual Studio 2010 / Visual Studio 2010 Express – workaround

March 31, 2011 Leave a comment

This is just a quick workaround to get the installation done – nothing else (really a reminder to myself)

I have a project to provision VMs from a customised front-end,
I have created a C# tool – that integrates with SCCM as well as our various asset management tools and some scripting environments, to allow for a ‘1 button deployment’

Of course . . to be a true one button deployment, I’d like to be able to actually create a VM when using the same ‘Big Red Button’

Anyway, my development environment happens to be Visual Studio 2010 – so yes simple . . let’s get going, surely we just follow the setup guide provided at :

http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/sdk40setupguide.pdf – page 19

Well, that would work, except that the SDK kit has not yet gotten the relevant batch files for a Visual Studio 2010 installation.

The solution to get the installation working was to get a copy of the amended cmd from the VMWare communities:
http://communities.vmware.com/servlet/JiveServlet/download/1225636-21465/genvimstubs2.cmd
and copy it to your .\sdk\samples\DotNet directory

Next, go to : Start Menu\Programs\Microsoft Visual Studio 2010\Visual Studio Tools and select Visual Studio Command Prompt (2010)

Now, make sure that you have the environmental variable VCINSTALLDIR set to point to your Visual Studio installation path (type ‘set’ to see your environmental variables)
I had to set it like this:

SET VSINSTALLDIR="c:\Program Files (x86)\Microsoft Visual Studio 10.0"

Finally, I had to run the installer.]
In my case, the SDK was at d:\VMWare\SDK\samples, so I ran:

D:\VMWare\SDK\samples\DotNet>genvimstubs2.cmd d:\VMWare\SDK\wsdl\vim25 Vim25Api stage Vim25Objects.cs . Vim25Service2005

Installation looks like this:

D:\VMWare\SDK\samples\DotNet>genvimstubs2.cmd d:\VMWare\SDK\wsdl\vim25 Vim25Api
stage Vim25Objects.cs . Vim25Service2005
Checking and Creating stage
The system cannot find the file specified.
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version
2.0.50727.1432]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file ‘stage\Vim25Objects.cs’.
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.4926
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.

Microsoft (R) Xml Serialization support utility
[Microsoft (R) .NET Framework, Version
2.0.50727.1432]
Copyright (C) Microsoft Corporation. All rights reserved.
Serialization Assembly Name: Vim25Service2005.XmlSerializers, Version=0.0.0.0, C
ulture=neutral, PublicKeyToken=null.
Generated serialization assembly for assembly D:\VMWare\SDK\samples\DotNet\vim25
service2005.dll –> ‘.\Vim25Service2005.XmlSerializers.dll’.
Optimizing generated stubs…
Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.4926
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.

Stub generation Done.
ECHO is off.

From here you can continue using the instructions in the getting started guide above.

Categories: Scripting, VMWare Tags: ,

Using regular expressions to parse files in PowerShell

March 28, 2011 Leave a comment

How often do you find yourself needing to identify a string in a file somewhere.

For example, you have a log file, or a config file and you know it contains an IP address, but you do not want to manually trawl through this file (or even worse . . these files)

Regular expressions are pretty handy, as you can use them to identify (and edit) strings of text pretty simply. thik of it as a Replace function on steroids.

Here are some examples:
http://www.regular-expressions.info/quickstart.html

Anyway, back to our original question – we’d like to find an IP address in a file.

The first thing of course is to get hold of the text in our file – we’ll drop it into an array, so we can do a line by line comparison..

$var = @(Get-Content .\Access*.log)

Next, we need to create a Regex string pattern, which we will use as reference when we query out text – there are plenty examples available on the web (e.g. http://www.regular-expressions.info/examples.html) – but we just need one to find IP addresses:

$regex = [regex] "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"

Lastly, we simply need to return a list of elements in our array, where the array matches the REGEX search string – again simple:

$regex.matches($var) | Select-Object -unique -property "Value"

so the full bit of code:

$var = @()
$var = Get-Content .\Access*.log
$regex = [regex] "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"
$regex.matches($var) | `Select-Object -unique -property "Value"

Value

Upgrading ESXi without VUM

March 24, 2011 Leave a comment

It seems that VMWare are getting rid of VUM (I assume something new will be released soon to replace it), so more and more people are going to need to manage ESXi upgrades from the command line.
I suspect that the people that will be most affected by this are people running the free version of ESXi.

Anyway, here is a quick how to, for ESXi upgrades.

First enable ssh access to the ESXi4.0 box.

At the ESXi console:
1. alt-f1
2. Type unsupported (You will not see your typing)
3. root pw
4. vi /etc/inetd.conf
5. uncomment the 2 ssh lines, i.e delete the “#” preceding the ssh config lines (esc x to delete a character in vi)
6. :wq to save the changes in vi and quit the vi editor
7. services.sh restart (if necessary reboot the ESXi box if ssh still does not work)

If you are running ESX4.1, follow this guide to enable SSH access to ESXi4.1 Host
(again at the console)

1.Press F2 to Customize System Settings
2.Navigate to Troubleshooting Options
3.Select ‘Enable remote Tech support (SSH)

Note – you can also adjust the tech support timeout here – so you could limit how long tech support stays enabled for.

Next, you will need to download your upgrade bundle from VMWare –

You now have 2 Options,

Run the installation – Option 1 – from a webserver
If you are able to store the upgrade bundle on a webserver, you could do the following:
Place the file upgrade-from-ESXi4.0-to-4.1.0-0.0.260247-release.zip at the root directory of your web server.
I use Apache Tomcat 7.0 on Windows XP to host the file upgrade-from-ESXi4.0-to-4.1.0-0.0.260247-release.zip
Ensure the Windows Firewall allows access from external hosts to your web server (In the case of Apache Tomcat, I had to open port 8080)
VMotion all the VMs off of you host, or Shut down all VMs, and put the host into maintenance mode.
SSH to your ESXi4.0 box and at the CLI type:
esxupdate –bundle http://ipaddress:8080/upgrade-from-ESXi4.0-to-4.1.0-0.0.260247-release.zip update (Of course this value will change dependent on your filename)
The zip file will be downloaded from your web server and installed. Reboot the ESXi server when prompted.

Run the installation – Option 2 – from a local instance of the upgrade bundle
If you do not have a web server handy, you could copy the bundle locally on the ESXi host. – or even on a shared datastore accessed by multiple ESXi hosts if you have shared storage.
Using FastSCP(my preference, but any SCP style tool will work e.g. WinSCP) – Copy the upgrade bundle to the ESXi host(or shared store)
VMotion all the VMs off of you host, or Shut down all VMs, and put the host into maintenance mode.
SSH to the host (I use putty, but any SSH tool will work)
From the command line of the host, execute the command: esxupdate –bundle /vmfs/volumes/<datastorename>/<myfolder>/upgrade-from-ESXi4.0-to-4.1.0-0.0.260247-release.zip update
The zip file will be extracted and installed

Reboot the host
Reboot the host when done. Once that’s complete, take the host back out of maintenance mode, and power on the virtual machines.
You’ll possibly have new VMtools available, so upgrade these.

If your host refuses to start up and you are having issues, you should be able to revert to your previous installation by hitting Shift-R as the host boots up.

Categories: VMWare

Finding VMs with disks on multiple different datastores – Script of the Day

March 23, 2011 Leave a comment

I was looking at a VM on one of our hosts and noticed the rather odd configuration showed that the VM had 2 disks provisioned (not unusual), and that the 2 disks had been presented on different storage (very unusual for non clustered VMs in our environment)

I figured, the easiest way to identify all of the VMs that are using VMDKs on multiple different datastores was PowerCli.

The result – just a one liner.

PS:7 >get-vm | ?{$_.DatastoreIdList.count -gt 1}

Name                 PowerState Num CPUs Memory (MB)
----                 ---------- -------- -----------
labserver001     PoweredOn  1        8192
labserver 17a         PoweredOn  2        1280
labserver21        PoweredOn  1        8192
labserver17b         PoweredOn  2        1152

How to migrate and convert physical RDMs

March 21, 2011 1 comment

Ken Gottleib, the Principle Virtualization Consultant at Winchester Systems, Inc. USA recently posted the following very useful bit of info over on the VMWare communities site.

I quickly dropped him a note and asked for permission to duplicate his work, as I have had this same issue before and never documented the process properly.

"This is what you need to do, fully explained the way each and every post should be. You must power the VM down to do this, there is no way to do it live. Period

1) log into ESX console as root
2) navigate to your virtual machine folder: /vmfs/volumes/vmfs-volume-freindlyname/vm-folder/
3) locate the pointer file for your disk, this is not the -rdmp file, this is the servername_1.vmdk, it is only a few KBs, inside it does nothing but point to the actual disk file, which in this case will be the servername_1-rdmp.vmdk. It is this servername_1-rdmp.vmdk file that maps IO to the actual lun which is always represented by ESX as something like vml.xxxxxxxxxxxxxxx and can be viewed in /vmfs/devices/disks/

The source you are looking to migrate (with this method it is actually a copy which is good, because the source is always left intact) can be a virtual disk, virtual rdm, or physical rrdm, it doesnt’ matter, you will always use the servername_x.vmdk file as the source in the command string you are about to see… but before I continune, if you want to migrate from physical compatibility mode lun to a new physical compatibility mode lun, be sure to have provisioned the lun so ESX can see it. If you are to convert the physical mode RDM to virtual RDM, the same applies. If you are to convert it to virtual disk, just be sure you have a vmfs volume with enough space to accomodate the new disk.

4) here it is:
To migrate and convert physical RDM to virtual disk:
vmkfstools -i servername_1.vmdk /vmfs/volumes/vm folder/servername-newdisk_1.vmdk
To migrate and convert physica RDM to virtual RDM, there are two methods
– in vi client edit VM settings of powered down VM, remove rdmp mapped disk, then re-add a new hard disk selecting the same disk only be sure to select virtual as the mode, you will log in and see all of your data and mount points are unchanged.
– from the ESX prompt in the virtual machine folder on the VMFS volume:
vmkfstools -i servername_1.vmdk -d rdm:/vmfs/devices/disks/vml.xxxxxxxxxxxxxxxxxxxxxxxx /vmfs/volumes/vm folder/servername_1-rdm.vmdk
To migrate physica RDM to a new physical RDM:
vmkfstools -i servername_1.vmdk -d rdmp:/vmfs/devices/disks/vml.xxxxxxxxxxxxxxxxxxxx /vmfs/volumes/vm folder/servername_1-rdmp.vmdk

Command strings EXPLAINED:
vmkfstools -i is the import \ clone command
the servername_x.vmdk is the source, the x will stand for the order of the device, in my example I use 1 which means this is the second disk on the VM. the first disk file is servername.vmdk, this is typically always the system disk.
the -d is the disk type for the destination you are converting to
the rdm(p) is part of the disk type telling the destination disk what the raw disk mode is, virtual or physical (the p means physical obviously)
the /vmfs/volumes/vm folder/servername_1-rdm.vmdk tells us the location of where to store the raw disks mapping file, I have chosen to put it in the virtual machine folder as you can see, you can put it on any vmfs file system, I like to keep things neat and clean.

Figuring out which vml.xxxxxxxxxxxxxxx is tricky.. I the ls-lh command on the /vmfs/devices/disks/ directory to list the unfriendly volume names out and figure out which one is mine by the LUN size, there are other ways to do this, there is a VMware KB article that describes other ways to dump out this information. and in some cases, depending, there may be a partition involved and it would look like vml.xxxxxxxxxxxxxxxx:1 or :2 or whatever.. vmware’s KB references it as vml.xxxxxxxxxxxx:p
you can also use vmhbax:x:x: in the string as such: /vmfs/devices/disks/vmhbax:x:x:p to represent the raw LUN
check out this article, it has what you need, but not everything.. the example they use for the disk is naa.xxxxxxxxxxxxxxxxx and I believe this is because there is different storage in use then I have… SO, be sure to navigate to /vmfs/devices/disks/ to see how vmware lists out the disks as the storage presents them

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=3443266

Hope you find this useful, don’t let anyone tell you that you can’t migrate a physical RDM. Its bogus information. This is how its done."

Categories: Uncategorized
Follow

Get every new post delivered to your Inbox.