Category Archives: VMware

Indianapolis VMUG User Conference – 26th July 2012

image

Next week I will be presenting at the Indianapolis VMUG User Conference, yet another VMUG I have never been to but I hear great things about, im looking forward to catching up with the usual VMUG frequenters and also some of the local folk.

I will be presenting the following sessions , if you are at the VMUG make sure you attend or at least come by and say Hi!

VMware PowerCLI

This will take place in the Sagamore 5-7 room and will be at 11:00 – 11:45

Tired of clicking the Next, Next, Next, button for those simple jobs ?

Do you have a vSphere or vCD task you repeat every month, week, day or even hour ?

Join me in this PowerCLI session as I take you from beginner to Scripting Ninja.  In this session I will show you not only how to use PowerCLI but also how to teach yourself, I will show you the great resources available on the internet and how to take PowerCLI to the next level.

If you do it more than once, come learn how to script it!

Event Details

Thursday, July 26, 2012
8:00 a.m. – 5:00 p.m.

Indiana Convention Center
100 S. Capitol Avenue
Indianapolis, IN 46225

Make sure you register here before attending.

Agenda

A copy of the full agenda and other sessions taking place can be found here: http://www.vmug.com/index.php?mo=cm&op=ld&fid=201

VMworld Session Voting

Disclaimer: This lady will not be at my session!I’m sure by now you have already seen that the VMworld Voting is open which means its time to have your say on what you want to see at VMworld, if you have not yet signed up for a VMworld account so that you can vote then please do so by following this link.

Now I could do the normal “Vote for me because because PowerCLI will solve world famine” post but I thought I would do something different to the rest, what I’m going to do is just use the coolness of PowerShell to allow you to find my sessions, once you have them on your screen have a read of them for yourself and then you can decide if you ant to vote for them or not.

You can do that by simply changing the username and password parts of the script below and allowing it to log into the VMworld site and display my sessions for you.  This will of course not click the “Vote” button as that would be cheating, it will however give you a nice list of my sessions where you can click to get further information.

If however you like what you see and want to vote then just click the thumb picture to make it green and I will thank you forever more and we will see what we can do about world famine.

Use the Script

$VMworldUser = "myvmworldusername"
$VMworldPassword = "myvmworldpassword"
# Replace the username and password above

$ie = New-Object -com InternetExplorer.Application
$ie.visible=$true
$ie.navigate("http://www.vmworld.com/www.vmworld.com/cfp-login!input.jspa")
while($ie.ReadyState -ne 4) {start-sleep -m 100}
$ie.document.getElementById("username01").value= $VMworldUser
$ie.document.getElementById("password01").value = $VMworldPassword
$ie.document.getElementById("loginformaction").submit()
while($ie.Document.url -ne "https://vmworld2012.activeevents.com/scheduler/publicVoting.do") {start-sleep -s 7}
$ie.document.getElementById("searchEl").value = "Renouf"
$ie.Document.getElementById("displayOptionsForm").submit()

Overview

Here are a list of the submissions I have put forward for VMworld this year:

image

Updated Script to remediate VDS/SvMotion issue

Following my recent post where I showed how we could search for and fix any VMs which had an issue after being Storage vMotioned and attached to a VDS I received a couple of emails from people with a few issues.

Firstly the script was written using the VDS PowerShell fling (Check it out, its cool), some people were not able to use this fling in production systems as it is not officially supported by VMware.

Secondly the fling only supported VDS and not the Nexus 1kv, some customers had this issue with the N1KV so needed a resolution.

The good news…

I have re-written the script to no longer use the fling but instead use the raw API’s, this means all you now need is PowerCLI 5.0.1 and you can run the below script in the same way as before to check and remediate for issues.

Thanks goes to Luc who came up with an easy way to check for free ports on the VDS here.

Remember this does not fix the issue completely, only a patch from VMware will do that but it does however tell you if you have the issue and plug the gap temporarily.

Just as a reminder, here is how the script is used:

Using the script

To check the VMs we can easily pipe a list of VMs into our function which can be seen below.  This can be all VMs in a Cluster, all VMs on a particular host or any other list of VMs you can think of, for my examples below I have shown all VMs attached to a vCenter

image

As you can see from the above screenshot, all VMs are fine apart from VM12 which currently has the problem described in Duncan’s article,  now to fix the issue.

We can use the same script with a –Fix parameter which allows us to fix the issue, when fixing the issue the script will move each of the VMs network connections to a new port on the same portgroup and then move it back again to its original port.   If no free ports are available the script will expand your portgroup temporarily and then decrease the ports when finished.

image

As you can see from the above screenshot, the issue has now been resolved for this VM by using the function with the –Fix parameter and further running of the script in test mode will show all are now fine.

The Script

Function Get-FreeVDSPort ($VDSPG) {
	$nicTypes = "VirtualE1000","VirtualE1000e","VirtualPCNet32","VirtualVmxnet","VirtualVmxnet2","VirtualVmxnet3"
	$ports = @{}

	# Get all the portkeys on the portgroup
	$VDSPG.ExtensionData.PortKeys | Foreach {
		$ports.Add($_,$VDSPG.Name)
	}

	# Remove the portkeys in use  Get-View
	$VDSPG.ExtensionData.Vm | Foreach {
	    $VMView = Get-View $_
		$nic = $VMView.Config.Hardware.Device | where {$nicTypes -contains $_.GetType().Name -and $_.Backing.GetType().Name -match "Distributed"}
	    $nic | where {$_.Backing.Port.PortKey} | Foreach {$ports.Remove($_.Backing.Port.PortKey)}
	}

	# Assign the first free portkey
	if ($ports.Count -eq 0) {
		$null
	} Else {
		$ports.Keys | Select -First 1
	}
}

Function Set-VDSPGNumPorts ($VDSPG, $NumPorts) {
	$spec = New-Object VMware.Vim.DVPortgroupConfigSpec
    $spec.numPorts = $NumPorts
	$spec.ConfigVersion = $VDSPG.ExtensionData.Config.Configversion
    $VDSPG.ExtensionData.ReconfigureDVPortgroup($spec)
}

Function Test-VDSVMIssue {
	Param (
		[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
        [PSObject[]]$VM,
		[switch]$Fix
	)
	Process {
		Foreach ($VMachine in $VM){
			Foreach ($NA in ($VMachine | Get-NetworkAdapter)) {
				$VMName = $VMachine.Name
				If (($NA.ExtensionData.Backing.GetType()).Name -eq "VirtualEthernetCardDistributedVirtualPortBackingInfo") {
					$PortKey = $NA.ExtensionData.Backing.Port.PortKey
					$vSwitchID = $NA.ExtensionData.Backing.Port.SwitchUUID
					$Datastore = (($VMachine.ExtensionData.Config.Files.VmPathName).split("]")[0]).Replace("[","")
					$filename = "$($datastore):\.dvsData\$vSwitchID\$PortKey"
					if (-not (Get-PSDrive $datastore -ErrorAction SilentlyContinue)) {
						$NewDrive = New-PSDrive -Name $Datastore -Location (Get-Datastore $Datastore) -PSProvider VimDatastore -Root '\'
					}
					$filecheck = Get-ChildItem -Path $filename -ErrorAction SilentlyContinue
					if ($filecheck) {
						Write-Host -ForegroundColor Green "$VMName $($NA.Name) is OK"
					} Else {
						Write-Host -ForegroundColor Red "Problem found with $VMName $($NA.Name)"
						If ($Fix) {
							Write-Host -ForegroundColor Yellow "Fixing issue..."
							$VDSPG = Get-VirtualPortGroup -Distributed -Name $NA.NetworkName
							$DVPort = $null
							Write-Host -ForegroundColor Yellow "..Finding free port on $($NA.NetworkName)"
							$DVPort = Get-FreeVDSPort $VDSPG
							$Move = $True
							if (-not $DVPort) {
								Write-Host -ForegroundColor Yellow "..No free ports found on $($VDSPG.Name), adding an additional port"
								If (($VDSPG.ExtensionData.Config.Type -ne "lateBinding") -and ($VDSPG.ExtensionData.Config.Type -ne "earlyBinding")) {
									Write "Unable to add a port to $($NA.NetworkName) since dvportgroup is configured as $($VDSPG.PortBinding)"
									Write-Host -ForegroundColor Red "Problem still exists with $VMName please resolve manually"
									$Move = $false
								} Else {
									$CurrentPorts = $VDSPG.NumPorts
									$NewTotalPorts = $VDSPG.NumPorts + 1
									Set-VDSPGNumPorts -VDSPG $VDSPG -NumPorts $NewTotalPorts
									$PGAdded = $true
									$VDSPG = Get-VirtualPortGroup -Distributed -Name $NA.NetworkName
									$DVPort = Get-FreeVDSPort $VDSPG
								}
							}
							If ($Move){
								Write-Host -ForegroundColor Yellow "..Moving $($NA.Name) to another free port on $($VDSPG.Name)"
								$NA | Set-NetworkAdapter -PortKey $DVPort -DistributedSwitch $VDSPG.VirtualSwitch -Confirm:$false | Out-Null
								Write-Host -ForegroundColor Yellow "..Moving $($NA.Name) back to port $PortKey"
								$NA | Set-NetworkAdapter -PortKey $PortKey -DistributedSwitch $VDSPG.VirtualSwitch -Confirm:$false | Out-Null
								Write-Host -ForegroundColor Yellow "..Checking changes were completed"
								$filecheck = Get-ChildItem -Path $filename -ErrorAction SilentlyContinue
								if ($filecheck) {
									Write-Host -ForegroundColor Green "$VMName $($NA.Name) is now fixed and OK"
								} Else {
									Write-Host -ForegroundColor Red "Problem still exists with $VMName please resolve manually"
								}
								If ($PGAdded) {
									Write-Host -ForegroundColor Yellow "..Removing the added port on $($VDSPG.Name)"
									Set-VDSPGNumPorts -VDSPG $VDSPG -NumPorts $CurrentPorts
									$PGAdded = $false
								}
							}
						}
					}
				} Else {
					Write-Host -ForegroundColor Green "$VMName is not connected to a dvSwitch so this issue is not relevant."
				}
			}
		}
		Get-PSDrive | Where { ($_.Provider -like "*VimDatastore") -and ( $_.Name -notlike "*vmstore*")} | Foreach {
			Remove-PSDrive $_ | Out-Null
		}
	}
}

# Example code to check all VMs attached to vCenter for the issue:
# Get-VM | Test-VDSVMIssue

# Example code to fix all VMs attached to vCenter:
# Get-VM | Test-VDSVMIssue -Fix

# Example code to fix all VMs in Cluster01 for the issue:
# Get-Cluster01 | Get-VM | Test-VDSVMIssue

# Example code to fix all VMs in Cluster01:
# Get-Cluster01 | Get-VM | Test-VDSVMIssue -Fix

Carolina VMUG–15th May 2012

image

Next week I will be presenting at the Carolina VMUG, im looking forward to this one as I get the chance to view a part of America I have never visited before and also catch up with some friends and people I have never met face to face.

I will be presenting twice at the VMUG, once on PowerCLI for vCloud Director and another time presenting with Josh Atwell, Josh is a such a great and enthusiastic guy who has some fantastic ideas and the humor to make our session a fun time for all. If you have never visited Josh’s blog I suggest you head over to http://www.vtesseract.com/ – Who knows where he gets some of the images for his posts ?!

I will be presenting the following sessions , if you are at the VMUG make sure you attend or at least come by and say Hi!

PowerCLI 201

Presenting with Josh Atwell we will take you through the basics of PowerCLI and then progress to some more advanced topics showing you how to use Community code and make the most of the wealth that is provided by the PowerShell and PowerCLI Community.

This session is sure to be great fun and will include some tips and tricks which any vSphere admin will not want to miss.

vCloud Director PowerCLI

This session will show you the basics and also some advanced parts of PowerCLI 5.0.1 and specifically how to use these to not only report on your cloud infrastructure but also how to create one from scratch, save time and make your life easier as a cloud admin.

This is the perfect addition to Chris Colotti’s session earlier that day (a must attend).

Event Details

Tuesday, May 15, 2012

8:00 a.m. – 5:00 p.m.

Charlotte Convention Center
501 South College Street
Charlotte, NC 28202
Click here for directions.

Make sure you register here before attending.

Agenda

A copy of the full agenda and other sessions taking place can be found here: http://www.vmug.com/d/do/1280

Identifying and fixing VMs Affected By SvMotion / VDS Issue

Duncan Epping recently described an issue with virtual machines (VMs) which have moved via Storage vMotion (SvMotion) and are connected to a vNetwork Distributed Switch (VDS), if you are using a configuration where VMs are connected to a VDS and could potentially move via SvMotion then please make sure you read his article here.

William recently showed how we could check for this issue using Perl, on this post you will see a similar script which uses PowerCLI to look for the issue and also resolve the issue fixing the VMs which could potentially have an issue.

In this script I use the VMware VDS Fling which adds VDS cmdlets to PowerCLI, more information and lots of examples on this fling can be found here.  Please make sure you have it installed before using this script and are using a 32 bit PowerShell or PowerCLI console.

Using the script

To check the VMs we can easily pipe a list of VMs into our function which can be seen below.  This can be all VMs in a Cluster, all VMs on a particular host or any other list of VMs you can think of, for my examples below I have shown all VMs attached to a vCenter

image

As you can see from the above screenshot, all VMs are fine apart from VM12 which currently has the problem described in Duncan’s article,  now to fix the issue.

We can use the same script with a –Fix parameter which allows us to fix the issue, when fixing the issue the script will move each of the VMs network connections to a new port on the same portgroup and then move it back again to its original port.   If no free ports are available the script will expand your portgroup temporarily and then decrease the ports when finished.

image

As you can see from the above screenshot, the issue has now been resolved for this VM by using the function with the –Fix parameter and further running of the script in test mode will show all are now fine.

UPDATE: The script has now been updated to support remediation for VMs connected to both a VMware VDS as well as Cisco N1KV. The solution, thanks to one of our internal engineers was to “move” the VM’s dvport from one to another, all while staying within the existing dvPortgroup which will also force the creation of the .dvsdb port file. Once the dvport move has successfully completed, we will move it back to it’s original dvport that it initially resided on. We no longer have to rely on creating a temporally dvPortgroup and best of all, we can now remediate both VDS and N1KV.

Disclaimer: This script is not officially supported by VMware, please test this in a development environment before using on production systems.

The Script

If (-Not (Get-PSSnapin VMware.VimAutomation.VdsComponent -WarningAction SilentlyContinue) ) {
	Add-PSSnapin VMware.VimAutomation.VdsComponent
}

Function Test-VDSVMIssue {
	Param (
		[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
        [PSObject[]]$VM,
		[switch]$Fix
	)
	Process {
		Foreach ($VMachine in $VM){
			Foreach ($NA in ($VMachine | Get-NetworkAdapter)) {
				$VMName = $VMachine.Name
				If (($NA.ExtensionData.Backing.GetType()).Name -eq "VirtualEthernetCardDistributedVirtualPortBackingInfo") {
					$PortKey = $NA.ExtensionData.Backing.Port.PortKey
					$vSwitchID = $NA.ExtensionData.Backing.Port.SwitchUUID
					$Datastore = (($VMachine.ExtensionData.Config.Files.VmPathName).split("]")[0]).Replace("[","")
					$filename = "$($datastore):\.dvsData\$vSwitchID\$PortKey"
					if (-not (Get-PSDrive $datastore -ErrorAction SilentlyContinue)) {
						$NewDrive = New-PSDrive -Name $Datastore -Location (Get-Datastore $Datastore) -PSProvider VimDatastore -Root '\'
					}
					$filecheck = Get-ChildItem -Path $filename -ErrorAction SilentlyContinue
					if ($filecheck) {
						Write-Host -ForegroundColor Green "$VMName $($NA.Name) is OK"
					} Else {
						Write-Host -ForegroundColor Red "Problem found with $VMName $($NA.Name)"
						If ($Fix) {
							Write-Host -ForegroundColor Yellow "Fixing issue..."
							$VDSPG = Get-VdsDistributedPortgroup $NA.NetworkName
							$DVPort = $null
							Write-Host -ForegroundColor Yellow "..Finding free port on $($NA.NetworkName)"
							$DVPort = Get-VdsDVPort -DVPortgroup $VDSPG -Active:$false | Select -last 1
							$Move = $True
							if (-not $DVPort) {
								Write-Host -ForegroundColor Yellow "..No free ports found on $($VDSPG.Name), adding an additional port"
								If (($VDSPG.PortBinding -eq "Ephemeral") -or ($VDSPG.PortBinding -eq "Dynamic")) {
									Write "Unable to add a port to $($NA.NetworkName) since dvportgroup is configured as $($VDSPG.PortBinding)"
									Write-Host -ForegroundColor Red "Problem still exists with $VMName please resolve manually"
									$Move = $false
								} Else {
									$CurrentPorts = $VDSPG.NumPorts 
									$NewTotalPorts = $VDSPG.NumPorts + 1
									Set-VdsDistributedPortgroup -NumPorts $NewTotalPorts -DVPortgroup $VDSPG | Out-Null
									$PGAdded = $true
									$DVPort = Get-VdsDVPort -DVPortgroup $VDSPG -Active:$false | Select -last 1
								}
							}
							If ($Move){
								Write-Host -ForegroundColor Yellow "..Moving $($NA.Name) to another free port on $($VDSPG.Name)"
								$NA | Set-NetworkAdapter -PortKey $DVPort.Key -DistributedSwitch $VDSPG.VirtualSwitch -Confirm:$false | Out-Null
								Write-Host -ForegroundColor Yellow "..Moving $($NA.Name) back to port $PortKey"
								$NA | Set-NetworkAdapter -PortKey $PortKey -DistributedSwitch $VDSPG.VirtualSwitch -Confirm:$false | Out-Null
								Write-Host -ForegroundColor Yellow "..Checking changes were completed"
								$filecheck = Get-ChildItem -Path $filename -ErrorAction SilentlyContinue
								if ($filecheck) {
									Write-Host -ForegroundColor Green "$VMName $($NA.Name) is now fixed and OK"
								} Else {
									Write-Host -ForegroundColor Red "Problem still exists with $VMName please resolve manually"
								}
								If ($PGAdded) {
									Write-Host -ForegroundColor Yellow "..Removing the added port on $($VDSPG.Name)"
									Set-VdsDistributedPortgroup -NumPorts $CurrentPorts -DVPortgroup $VDSPG | Out-Null
									$PGAdded = $false
								}
							}
						}
					}	
				} Else {
					Write-Host -ForegroundColor Green "$VMName is not connected to a dvSwitch so this issue is not relevant."
				}
			}
		}
		Get-PSDrive | Where { ($_.Provider -like "*VimDatastore") -and ( $_.Name -notlike "*vmstore*")} | Foreach {
			Remove-PSDrive $_ | Out-Null
		}
	}
}

Silicon Valley VMUG – April 11th

imageMy family and I are relocating ourselves to California, with the start of our new lives there will be a new VMUG, I have to say the London VMUG has set the standards pretty high so I can not wait to see what my new local VMUG will be like.

My new local VMUG will be of course the Silicon Valley VMUG (SVVMUG), and I have to say with the below Agenda its looking pretty darn good so far !

The SVVMUG is on April 11th and details are below, I have of course put myself down to present, this time I will be presenting with a well known VMware Community member, fellow member of VMware Technical Marketing and all round fantastic guy, Mr. William Lam, make sure you check out his blog (I’m sure you do already).

Together we will be presenting a vSphere CLI Overview.

vSphere CLI Overview

In this presentation William and I will give a good overview with where we are in vSphere 5, if your getting your ESXCLI’s mixed up with your PowerCLI’s or if you are bored of doing the same manual tasks each day then make sure you attend our presentation to get a good overview of what is available to help you automate your life!

We will also be sticking around for the rest of the VMUG (and hopefully SVVMUG has a vBeers ?) so make sure you come up and say Hi and have a chat to us. Being a local for only a week at that time I would love to meet as many people as possible !

Register

Wednesday, April 11, 2012

8:00 a.m. – 5:00 p.m.

Santa Clara Marriott
2700 Mission College Blvd.
Santa Clara, CA 95054
Click here for directions.

Make sure you register here before attending.

Agenda

Meeting Agenda
TIME EVENT LOCATION
8:00 – 8:30 am Registration | Breakfast | Mingle with Vendors California Ballroom Foyer
8:30 – 8:45 am VMUG Welcome California Ballroom 4-6
8:45 – 9:45 am Keynote Presentation with Mike Laverick California Ballroom 4-6
9:45 – 10:00 am Break | Mingle with Vendors California Ballroom 4-6/Foyer
10:00 – 10:45 am Breakout Block #1 | Education Sessions  
Dell Incorporated – Accelerate VDI success with Dell EqualLogic unified virtualized storage and VMware View California Ballroom 1-2
Symantec – High availability and business continuity for applications in VMware environments. California Ballroom 3
Veeam Software Corp – Why Legacy Backup Tools Don’t Work in Virtual Environments California Ballroom 7
EMC Corp – Maximizing Performance And Efficiency For Enterprise Applications With EMC and Isilon California Ballroom 8-9
VMware Labs Seattle, Portland, Santa Barbara
10:45 – 11:00 am Break | Mingle with Vendors California Ballroom 4-6/Foyer
11:00 – 11:45 pm Breakout Block #2 | Education Sessions  
VMware – Why Virtualize Business Critical Applications (Oracle, SAP, Exchange, SQL, Java)? California Ballroom 1-2
VMware – Troubleshooting Storage Performance (Is it the Hardware or the Software?) California Ballroom 3
VMware – Redefining the Standard for Operations Management with vCenter Operations California Ballroom 7
VMware – vSphere CLI Overview California Ballroom 8-9
VMware Labs Seattle, Portland, Santa Barbara
11:45 – 12:30 pm Lunch California Ballroom 4-6/Foyer
12:30-1:30 pm VMware Update | Steve Herrod – Senior Vice President of Research & Development California Ballroom 4-6
1:30 – 1:45 pm Break | Mingle with Vendors California Ballroom 4-6/Foyer
1:45 – 2:30 pm Breakout Block #3 | Education Sessions  
Zerto – Disaster Recovery-as-a-Service from The iFish Group Leveraging Zerto Virtual Replication California Ballroom 1-2
Nimble Storage – Stress-Free Data Protection for VMware and VDI California Ballroom 3
Xsigo Systems – Evolution of Data Center Fabrics California Ballroom 7
Hewlett-Packard – Understanding and Optimizing Storage Performance in vSphere California Ballroom 8-9
VMware Labs Seattle, Portland, Santa Barbara
2:30 – 2:45 pm Break | Mingle with Vendors California Ballroom 4-6/Foyer
2:45 – 3:30 pm Breakout Block #4 | Education Sessions  
VMware – Architecting and Building a Secure Virtual Infrastructure and Private Cloud California Ballroom 1-2
VMware – Performance Best Practices for vSphere California Ballroom 3
VMware – Virtualized Performance Monitoring Counters (vPMC) California Ballroom 7
VMware – A Guide to vSphere Distributed Switch (VDS) Deployments California Ballroom 8-9
VMware Labs Seattle, Portland, Santa Barbara
3:30 – 3:45 pm Break | Mingle with Vendors California Ballroom 4-6/Foyer
3:45 – 4:30 pm Breakout Block #5 | Education Sessions  
Cisco – Evolving the Data Center to Private Cloud California Ballroom 1-2
Trend Micro Inc. – Security at Every Stage: Trend Micro, VMware and Your Journey to the Cloud California Ballroom 3
Carrillo Business Technologies – Enterprise Consolidation California Ballroom 7
Coraid- Server Virtualization Demands a New Storage Architecture California Ballroom 8-9
VMware Labs Seattle, Portland, Santa Barbara
4:30 – 5:00 pm Closing California Ballroom 4-6

vCDAudit for vCloud Director

imageSometimes its hard to retrieve a report or data that you want to see in one place from a pre-built GUI, I often see this as a use case with PowerShell, being able to grab the data that you want to see and export it or report on it in a unified and simple way.  With the release of vCheck 6 and the easy to adapt HTML framework I have a very easy way to do just this, with a few simple changes to the plugins we can easily add any product into the reporting framework.

Currently this has been the case for vSphere and Exchange 2010.

A college of mine Tom Stephens who works for VMware Technical Marketing contacted me last week with a request which fits into the vCheck Framework quite nicely.  He was working with a customer who needed to be able to report on their vCD infrastructure, they had a need to be able to audit their vCD infrastructure and return certain data back in a centralized easy to read fashion.  He sent me a few headings of things the customer would like to see, after just a short period of time I was able to send him a working report with what the customer needed (and a little more I think).

This brings me on to what I call “vCDAudit”, unlike the vSphere health check script this is an audit script which retrieves and presents key vCD Data which is otherwise hard to find in a centralized place.

Example Page

An example of the vCDAudit report can be viewed by clicking here.

Download

To download this version of vCheck you can download the following file which includes the base script and all VCDAudit plugins:

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

For more information on the base vCheck script and its framework including a demo of how to use it visit this page.

 

vCheck Updated to 6.15

A quick update this time, mainly bug fixes but please see the change log below for more details.

[wpdm_file id=17]

As always you can find more information about vCheck and how to use this by visiting this page.

Change log

There are now over 70 plugins, some fantastic stuff, below is a list of items which have changed or been fixed since 6.0:

# v 6.15 – Added Category to all plugins and features to vCheckUtils script for Categorys.
# v 6.14 – Fixed a bug where a plugin was resetting the $VM variable so later plugins were not working 🙁
# v 6.13 – Fixed issue with plugins 63 and 65 not using the days
# v 6.12 – Changed Version to PluginVersion in each Plugin as the word Version is very hard to isolate!
# v 6.11 – Fixed a copy and paste mistake and plugin issues.

Reminder

If a plugin is not needed in your environment remove it from the plugins folder as it will speed up the execution of your script.

vCheck updated to 6.10

Thanks to all the people who sent me a plugin for vCheck 6.0, these have now been published as part of vCheck 6.10 and zipped into a single download file which can be downloaded from below.  I also love the enhancements which have been sent to me for the core vCheck script, these include a script which times and reports on how long the plugins take – great for troubleshooting !

[wpdm_file id=17]

As always you can find more information about vCheck and how to use this by visiting this page.

Change log

There are now over 70 plugins, some fantastic stuff, below is a list of items which have changed or been fixed since 6.0:

# v 6.10 – Fixed multiple spelling mistakes and small plugin issues
# v 6.9 – Fixed VMKernel logs but had to remove date/Time parser due to inconsistent VMKernel Log entries
# v 6.8 – Added Creator of snapshots back in due to popular demand
# v 6.7 – Added Multiple plugins from contributors – Thanks!
# V 6.6 – Tech Support Mode Plugin fixed to work with 5.0 hosts
# V 6.5 – HW Version plugin fixed due to string output
# V 6.4 – Added a 00 plugin and VeryLastPlugin for vCenter connection info to separate the report entirely from VMware if needed.
# V 6.3 – Changed the format of each Plugin so you can include a count for each header and altered plugin layout for each plugin.
# V 6.2 – Added Time to Run section based on TimeToBuild by Frederic Martin
# V 6.1 – Bug fixes, filter for ps1 files only in the plugins folder so other files can be kept in the plugins folder.

Reminder

If a plugin is not needed in your environment remove it from the plugins folder as it will speed up the execution of your script.

Removing the vCD Agent from hosts

When re-installing my vCD home lab I had an issue when I went to re-add some hosts which had already been used in a vCD environment, this was because the hosts had already been “prepared” by vCD and therefore had the “vcloud-agent” vib installed.  Of course you would normally unprepare these from the vCD web interface before deleting your vCD instance but I forgot to do this.

I was then pointed to Chris Colotti’s post here which showed how to manually remove the vCD agent from hosts in this situation.

As I had a few of them to do I didn’t want to repeat myself and therefore wrote a quick PowerCLI Script to remove the agents for me.

Another thing I couldn’t see in Chris’s post which I had to do before it was fully removed was reboot the host so I added that into the script too.

Checking for hosts with the vCD Agent installed

We can easily see the hosts which have the vCD agent installed by running the following PowerCLI code:

Connect-VIServer MyVIServer -User Administrator –Password “Pa$$word”
Get-VMHost | Sort Name | Foreach {
    $ESXCLI = Get-EsxCli -VMHost $_ -ErrorAction SilentlyContinue
    $ESXCLI.software.vib.list() | Where { $_.Name -like "*vCloud*"} | Select @{N="VMHost";E={$ESXCLI.VMHost}}, Name, Version
}

We would receive the following output:

image

Removing the vCD Agents

Due to an issue with the way PowerCLI calls ESXCLI I have had to make the script slightly more complicated than it needs to be but it still does the job.  It will go through each host and remove the “vcloud-agent” vib and then reboot them ready to be added into the new vCD instance.

# The following two variables are used to define the esx hosts local login details
$HostUser = "root"
$HostPass = "localpa$$"

$vCenter = Connect-VIServer MyviServer -User Administrator –Password “Pa$$word”
Get-Cluster | Get-VMHost | Sort Name | Foreach {
    $ESXCLI = Get-EsxCli -VMHost $_ -ErrorAction SilentlyContinue
     $vCDHosts = $ESXCLI.software.vib.list() | Where { $_.Name -like "*vCloud*"} | Select @{N="VMHost";E={$ESXCLI.VMHost}}, Name, Version
    $vCDHosts
}

$vCenter | Disconnect-VIServer -Force -Confirm:$false

# Because of a bug in PowerCLI with ESXCLI we need to connect to each host individually and not through vCenter
$vCDHosts | Foreach {
    $VMHCon = Connect-VIServer ($_.VmHost) -User $HostUser -Password $HostPass
    Write-Host "Removing vCloud Agent for $($_.VMHost)"
    $ESXCLI = Get-EsxCli -ErrorAction SilentlyContinue
    $ESXCLI.software.vib.remove($false, $true, $false, $true, $_.Name)
    # During testing I found a reboot was needed
    Write-Host "Rebooting host $($_.VMHost)"
    Restart-VMHost -VMHost $_.VmHost -Confirm:$false
    $VMHCon | Disconnect-VIServer -Confirm:$false
}