vExpert 2013

I realised on the weekend that I had not talked about one of the most exciting things that has happened to me in the last few months (besides a fantastic new role!), being awarded the vExpert 2013 status.

Over the last few years I have been lucky enough to be working on a number of projects, all Enterprise class deployments based on VMware. A brief list is included below:

  • Large Server platform based on vSphere 4.1 with HP c7000 Blade chassis and EMC VMax
  • Large VDI deployment on vBlock 700MX with Citrix Xendesktop and vSphere 5.0
  • Large Server platform based on vBlock 700MX with vSphere 5.0 and VPLEX.
  • Global Deployment of vSphere platforms across 36 countries based on vSphere 5.0 and NetApp.

Please see the following link to all the fantastic people who have been added or returned to the list this year:

http://communities.vmware.com/vexpert.jspa

As I have outlined this is a fantastic program. I only hope that I can make VMworld this year, but at this stage it is looking unlikely!

Further Adventures in Scripting

I wanted to explore some future areas where that I would like to write about:

1) Using Sharepoint as a VM deployment configuration source for automated VM deployment.

2) Using Sharepoint as an ESXi host deployment configuration source automated ESXi configuration.

3) Health checking in the vSphere environment, I think we can all agree that vCheck( thank you to the incredibly talented Alan Renouf) is the champion resource here and this can be found at:

http://www.virtu-al.net/vcheck-pluginsheaders/vcheck/

This is useful from SMB to large Enterprise scale environments.

4) My experiences with the VCAP-DCA and VCAP-DCD.

5) My work in progress experience to attempt the VCDX.

6) My adventures and experiences in the world of cloud computing.

Its funny to write about the things that you want to write about and I hope they can eventuate soon, although with a new job and two small children, my free hours are few and far between.

Improving the Speed of a script using Get-View

Working in an enterprise environment with a large number of virtual centers presents a number of problems. Where is the VM hosted?

This challenge led to some thinking and as we had previously delivered a utility scripting server, it seemed like a good idea to enable IIS, and host some freely available searchable web pages.

I then built a central location to host the output (a simple IIS server will suffice), then we created a list of virtual centers that needed to be contacted and put this in a text file, then it was simply a question cycling through each VC and appending the information to the end of the HTML file.

  • Each virtual center was then queried with the following script (with help from the VMware communities).
## for environments older that v4.0 (older API)
Get-View -ViewType ClusterComputeResource -Property Name | %{
    ## store this cluster in a variable for later use
    $viewThisCluster = $_
    Get-View -ViewType HostSystem -SearchRoot $viewThisCluster.MoRef -Property Name | %{
        ## store this host in a variable for later use
        $viewThisHost = $_
        ## get the .Net View object for all VMs (not templates) and return a bit of info for each; add info to the Report array
        Get-View -ViewType VirtualMachine -SearchRoot $viewThisHost.MoRef -Property Name, Guest.HostName, Config.Hardware.NumCPU, Config.Hardware.MemoryMB, Config.Hardware.Device, Guest.IPAddress, Runtime.PowerState, Config.DatastoreUrl -Filter @{"Config.Template" = "False"} | %{
            $Report += Select -InputObject $_ Name,
                @{N="DNS";E={$_.Guest.Hostname}},
                @{N="NumCPU"; E={$_.Config.Hardware.NumCPU}},
                @{N="MemoryMB"; E={$_.Config.Hardware.MemoryMB}},
                @{N="DiskGB";E={[Math]::Round((($_.Config.Hardware.Device | ?{$_ -is [VMware.Vim.VirtualDisk]} | Measure-Object -Property CapacityInKB -Sum).Sum / 1mb),2)}},
                @{N="IP Address";E={@($_.Guest.IPAddress)[0]}},
                @{N="State";E={$_.Runtime.PowerState}},
                @{N="VM VC";E={$VISRV}},
                @{N="Cluster";E={$viewThisCluster.Name}},
                @{N="ESX Host";E={$viewThisHost.Name}},
                @{N="Datastore";E={@($_.Config.DatastoreUrl | %{$_.Name})}},
                @{N="VM URL";E={"<a href=https://$VISRV/ui/vmDirect.do?view=" + ($URLVM = ($SdkUrlB64 = [System.Convert]::ToBase64String(([System.Text.Encoding]::ASCII.GetBytes("wsUrl=http://localhost/sdk&vmId=VirtualMachine|" + $_.MoRef.Value + "&ui=33")))) + "_") + ">$($_.Name)</a>"}}
        } ## end foreach-object
    } ## end Get-View for hosts
} ## end Get-View for Clusters
  • For newer environments (vSphere 4+) we used:

$Report = @()

Foreach ($VISRV in $VISRVs) {
if ($VISRV.contains($ProdDom))
{Connect-VIServer -Server $VISRV -user $UserProd -pass $PassProd}
else
{Connect-VIServer -Server $VISRV -user $UserLabs -pass $PassLabs}

Get-View -ViewType ClusterComputeResource -Property Name | %{
## store this cluster in a variable for later use
$viewThisCluster = $_
Get-View -ViewType HostSystem -SearchRoot $viewThisCluster.MoRef -Property Name | %{
## store this host in a variable for later use
$viewThisHost = $_
## get the .Net View object for all VMs (not templates) and return a bit of info for each; add info to the Report array
Get-View -ViewType VirtualMachine -SearchRoot $viewThisHost.MoRef -Property Name, Guest.HostName, Config.Hardware.NumCPU, Config.Hardware.MemoryMB, Summary.Storage.Committed, Guest.IPAddress, Runtime.PowerState, Config.DatastoreUrl -Filter @{“Config.Template” = “False”} | %{
$Report += Select -InputObject $_ Name,
@{N=”DNS”;E={$_.Guest.Hostname}},
@{N=”NumCPU”; E={$_.Config.Hardware.NumCPU}},
@{N=”MemoryMB”; E={$_.Config.Hardware.MemoryMB}},
@{N=”DiskGB”;E={[Math]::Round(($_.Summary.Storage.Committed / 1GB),2)}},
@{N=”IP Address”;E={$_.Guest.IPAddress[0]}},
@{N=”State”;E={$_.Runtime.PowerState}},
@{N=”VM VC”;E={$VISRV}},
@{N=”Cluster”;E={$viewThisCluster.Name}},
@{N=”ESX Host”;E={$viewThisHost.Name}},
@{N=”Datastore”;E={@($_.Config.DatastoreUrl | %{$_.Name})}},
@{N=”VM URL”;E={“<a href=https://$VISRV/ui/vmDirect.do?view=” + ($URLVM = ($SdkUrlB64 = [System.Convert]::ToBase64String(([System.Text.Encoding]::ASCII.GetBytes(“wsUrl=http://localhost/sdk&vmId=VirtualMachine|” + $_.MoRef.Value + “&ui=33”)))) + “_”) + “>$($_.Name)</a>”}}
} ## end foreach-object
} ## end Get-View for hosts
} ## end Get-View for Clusters

Disconnect-VIServer -Server $VISRV -Confirm:$false
}

($Report  | Convertto-Html -head $head -body $body -title $title -PostContent $postcont) -replace ‘&lt;’, “<” -replace ‘&gt;’, “>” -replace ‘<table>’, $tableout  | Out-File “$fileloc\$file”)

Now the code will return a list of VMs, there associated VC, a console link to the VM, and other quick reference data in a simple HTML format.

Welcome!

Hi all,

This is my first delve into blogging. I hope to at least provide a small piece of interesting reading once in a while!

Thanks to anyone in advance who reads this.