vmotion not available due to cdrom attached

Force dismount of CDROM. For those pesky admins that start with good intentions with the vmtools but do not complete.

Get-VM  | Get-CDDrive | Set-CDDrive -NoMedia -Confirm:$false

Checking vmware host vlan tagging

Checking network vlans.
Okay so I am use to being able to do a show run on the switching infrastructure attached to my virtual environment. However in my current position that ability has not been granted.

So I resorted to the following to test that trunking was setup correctly.

Create one guest (ubuntu live cd works great) on one host and another on another host.
Give these two guests an ip address on a range that is not within your companies / organisations ranges. For example if your company uses 19.20.21-31.0/24 then you could use Now gateway needed, once the hosts are up and running with an ip address simply do a ping using terminal from one guest to the other.

ping -c 10

Okay so that is great if we want to check one vlan but what if we have multilple vlans.

Well in this case you can use this powercli to change the vlan on both guests with a pause and then change, this can flick through all your vlans.

Get-VM -Name pingt1 | Get-NetworkAdapter | Set-NetworkAdapter -NetworkName vlan1 -Confirm:$false
Get-VM -Name pingt2 | Get-NetworkAdapter | Set-NetworkAdapter -NetworkName vlan1 -Confirm:$false
sleep 7
Get-VM -Name pingt1 | Get-NetworkAdapter | Set-NetworkAdapter -NetworkName vlan2 -Confirm:$false
Get-VM -Name pingt2 | Get-NetworkAdapter | Set-NetworkAdapter -NetworkName vlan2 -Confirm:$false

Easy hey.

Now to aid in building the network jumper powercli you can run the following.
Get-VDPortgroup | Select Name,VlanConfiguration,Datacenter | ft -a
Paste into excel and you have your list of vlans.

Dell Equallogic Update

Stop the press… this is a must read from Cormac Hogan..
Describes what we were seeing and still are seeing to a degree with HA or aam process locking up now. So we dont get a host not responding but the issue has moved from complete disaster to just a broken HA for the cluster. To fix often a hostd process restart is needed and occasionally a full reboot of the vsphere host.. This is still on esxi 4.1 with the latest build.


With the changes done in the above link we have reduced our issue significantly. Yes we still get the disconnect and reconnect but at less of a rate.
With the aid of splunk I found that we are getting volume moves (autoteiring) about 4 – 5 times a day on high load days however averaging about 2-3 a day (did not realise it was moving so much data).

So with the slices of cheese constantly moving the mouse occasionally simply has to open its mouth and bite….. okay a bit off track there.

When a slice moves from member to member we will see the disconnect and reconnect or close and successful login through splunk.
This is expected behaviour and this is what both VMware and Dell say to ignore, the question is whether you are seeing excessive entrys and whether they line up to what is occuring underneath as in slices moving.
If you find that they do line up, then you have done everything you can, do as VMWARE and DELL suggest and if the Log Entries frustrate you then disable the alarm.

I have found some very interesting write ups about the equallogic and I hate to admit it but I am a fan, they are my second favourite SAN now.
Mainly due to the cost and ease of maintenance / setup.

Anybody still playing in the dell equallogic space I plead with you to talk to your network guys.

Jumbo frames is not always 9000. Please set your jumbo frames on your switch ports to the cisco devices max (within jumbo frames, not talking baby jumbos here).
Most cisco equip will run a 9216, this allows the SAN and ESX to talk with a 9000 packet without it being fragmented when the switch adds its overhead.
When you get your network boffins to change this also plead (buy them coffee, redbull, coke) to turn on LLDP so you can turn on DLP within the Equallogic, this will greatly / dramtically reduce your retransmissions count.

To test this, download ethereal / wireshark.

On your iscsi virtual switch (hopefully you have a seperate switch but even capturing on the vlan will be okay) create a virtual machine port group and run up either a windows guest or linux.
Set the port group to accept promisicous mode and start ethereal capture.
Or tcpdump on linux.
btw… vlan 4096 is promisicous for all vlans in vmware.. be careful with this one though as you will capture a truck load of data in a large environment.

I like to capture around 1 Million packets and have great enjoyment trying to get the same number everytime.. yes you can automate this to capture a certain amount, but hey there is no reason this cannot be fun right.

So filter for “tcp.analysis.retransmission” and see how many you get… We hit the 5000 / 1 million packets and could repeat this count constantly.
Yes you can get the graphs from the equallogic about retransmissions but are you sure you are getting the whole picture?

Sadly we are moving away from the equallogic as my team does not have the trust in it anymore, but hopefully others out there can benefit from my findings to get theirs hummming..

And in case any of you are asking my SAN Weapon of choice is the Netapp.

“You mean avamar”
“no I mean dedupe”
“yeah avamar”
“not backups, data on disk connected to esx hosts as NFS or ISCSI or FC and dedupe’d”
“Okay let me paint a picture, 100 X Window 2008 R2 servers all patched to the same level with their System drives on the same 3Tb Datastore”
“lol, why would you do that”
“because I can, now shutup and listen. Each system drive is 40Gb in size, but installed only 12Gb is consumed”
“okay go on”
“On the datastore those 100 X Windows 2008 R2 servers are consuming 40Gb of disk if thick provisioned and less if thin provisioned”
“wait what, how?”

Creating a report for all virtual environments

So this is going to be a work in progress post.. A thoughts to paper post.

Here is what I have so far.

The below code will get details from the vCenter server and populate an excel spread sheet.
The inspiration is the sydi project scripts.

#By Whackdiddy
#Manager(s) quick report

Disconnect-VIServer * -Confirm:$false

#$config = Get-PowerCLIConfiguration
#if($config.DefaultVIServerMode -eq "Single"){
# Set-PowerCLIConfiguration -DefaultVIServerMode Multiple
#Open your vCenter or ESX(i) connections
#$vclist = Read-Host 'Enter the vCenter Server Names seperated by commas: '
#foreach ($vc in $vclist){
# connect-viserver -Server $vc

#$vcentername1 = Read-Host 'Enter 1st vCenter Server Name?'
#$vcentername2 = Read-Host 'Enter 2nd vCenter Server Name if none press enter?'
#$vcentername3 = Read-Host 'Enter 3rd vCenter Server Name if none press enter?'
#$vcentername4 = Read-Host 'Enter 4th vCenter Server Name if none press enter?'
#$vcentername5 = Read-Host 'Enter 5th vCenter Server Name if none press enter?'
#$vcentername6 = Read-Host 'Enter 6th vCenter Server Name if none press enter?'
#$vcentername7 = Read-Host 'Enter 7th vCenter Server Name if none press enter?'
echo "all connected"

#Create excel COM object
$excel = New-Object -ComObject excel.application

#Make Visible
$excel.Visible = $True
$excel.DisplayAlerts = $False

#Add a workbook
$workbook = $excel.Workbooks.Add()

#Name worksheets
$serverInfoSheet2 = $workbook.Worksheets.Item(1)
$serverInfoSheet2.Activate() | Out-Null
$serverInfoSheet2.Name = 'Dashboard'

$serverInfoSheet3 = $workbook.Worksheets.Item(3)
$serverInfoSheet3.Activate() | Out-Null
$serverInfoSheet3.Name = 'Host and Datastore'

$serverInfoSheet = $workbook.Worksheets.Item(2)
$serverInfoSheet.Activate() | Out-Null
$serverInfoSheet.Name = 'VM-Guest Info'

#Create a Title for the first worksheet
$row = 1
$Column = 1
$serverInfoSheet.Cells.Item($row,$column)= 'vMachine Report'

$range = $serverInfoSheet.Range("a1","n2")
$range.Merge() | Out-Null
$range.VerticalAlignment = -4160

#Give it a nice Style so it stands out
$range.Style = 'Title'

#Increment row for next set of data

#Save the initial row so it can be used later to create a border
$initalRow = $row

#Create a header for Disk Space Report; set each cell to Bold and add a background color
$serverInfoSheet.Cells.Item($row,$column)= 'VM_Name'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'VM FQDN'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'VM IP Address'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'VM MAC Address'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'VM Operating System'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'VM Operating System Family'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'vSphere Host'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'VM CPU Count'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'VM Memory'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'Custom Attrib'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'VM Network Cards'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'VM Disks'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'VM Harddisk'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'VM Harddisk used'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'VM Harddisk free'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'VM VMX Location'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'VM Datastore'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48
$serverInfoSheet.Cells.Item($row,$column)= 'vSphere Notes'
$serverInfoSheet.Cells.Item($row,$column).Interior.ColorIndex =48

#Set up a header filter
$headerRange = $serverInfoSheet.Range("a3","n3")
$headerRange.AutoFilter() | Out-Null

Get-View -ViewType VirtualMachine -Property Name, Runtime.Host,Config.Hardware, Guest.Disk ,Summary, Config.Hardware , Network , Guest | Where {-not $_.Config.Template} | %{
if($ip = ($_.Guest | %{$_.IpAddress})){

$serverInfoSheet.Cells.Item($row,3) = [string]::Join(',',$ip)
if(($mac = $_.Guest.Net | %{$_.MacAddress})){

$serverInfoSheet.Cells.Item($row,4) = [string]::Join(',',$mac)
$esx = Get-View $_.Runtime.Host -Property Name,Hardware.SystemInfo.Model,Parent





$memory = $_.Summary.Config.MemorySizeMB
$serverInfoSheet.Cells.Item($row,9).FormulaR1C1=("=IF($memory<1024,($memory & "" MB""),($memory/1024 & "" GB""))")




#$hdpath = ($_.Guest.Disk | Select DiskPath)
if($Partition = ($_.Guest.Disk | %{$_.DiskPath})){

$serverInfoSheet.Cells.Item($row,13) = [string]::Join(',',$Partition)
#$serverInfoSheet.Cells.Item($Row,13) = $_.Guest.Disk | Select DiskPath
#if($Capacity = ($_.Guest.Disk | %{$_.Capacity})){

#$serverInfoSheet.Cells.Item($Row,14) = [math]::Round(',',$Capacity)
#The below line works will vmtools installed on all guests
#$serverInfoSheet.Cells.Item($Row,14) = $_.Guest.Disk | Select Capacity
#if($freespace = ($_.Guest.Disk | %{$_.FreeSpace})){

#$serverInfoSheet.Cells.Item($Row,15) = [string]::Join(',',$freespace)


#"VM Datastore (location of vmx)
$serverInfoSheet.Cells.Item($row,17).FormulaR1C1 = $Mid




$usedRange = $serverInfoSheet.UsedRange
$usedRange.EntireColumn.AutoFit() | Out-Null

$dataRange = $serverInfoSheet.Range(("A{0}" -f $initalRow),("P{0}" -f $row))
7..12 | ForEach {
$dataRange.Borders.Item($_).LineStyle = 1
$dataRange.Borders.Item($_).Weight = 1

#$serverInfoSheet.ActiveCell.FormulaR1C1 = "=COUNTIF('VM-Guest Info'!R[-2]C[-6]:R[18]C[-6],'Dashboard'!RC[-1])"
#$serverInfoSheet.ActiveCell.FormulaR1C1 = "=COUNTIF('VM-Guest Info'!R4C7:R24C7,'Dashboard'!RC[-1])"
#$serverInfoSheet.Selection.AutoFill Destination:=Range("M6:M7"), Type:=xlFillDefault
#$serverInfoSheet.ActiveChart.ChartType = xlColumnClustered
#$serverInfoSheet.ActiveChart.SetSourceData Source:=Range("L6:M7")

#$lastRow = row

#Connect to first worksheet to rename and make active
$serverInfoSheet3 = $workbook.Worksheets.Item(3)
$serverInfoSheet3.Activate() | Out-Null

$RowX = 2

Get-View -ViewType HostSystem -Property Name,Hardware | %{
#$col = 12
$serverInfoSheet3.Cells.Item(2,2)= 'vSphere Host List'
$serverInfoSheet3.Cells.Item(2,3)= 'Number of Guests'
$serverInfoSheet3.Cells.Item(2,4)= 'Vendor'
$serverInfoSheet3.Cells.Item(2,5)= 'Model'
$serverInfoSheet3.Cells.Item(2,6)= 'No. CPU(s)'
$serverInfoSheet3.Cells.Item(2,7)= 'NO. Cores'
$serverInfoSheet3.Cells.Item(2,8)= 'Memory Size GB'

$serverInfoSheet3.Cells.Item($RowX,3).FormulaR1C1 = "=COUNTIF('VM-Guest Info'!R[1]C[4]:R3389C[4],'Host and Datastore'!RC[-1])"

if($HostMem = ($_.Hardware | %{$_.MemorySize})){

$lasthostchartrange = $Rowx


$RowY = 1
Get-View -ViewType Datastore -Property Name,Summary | %{
#$col = 12
$serverInfoSheet3.Cells.Item(2,12)= 'Datastore Name'
$serverInfoSheet3.Cells.Item(2,13)= 'Size (GB)'
$serverInfoSheet3.Cells.Item(2,14)= 'Free Space (GB)'
$serverInfoSheet3.Cells.Item(2,15)= 'No. VM(s)'
if($dstoreCapacity = ($_.Summary | %{$_.Capacity})){

#$serverInfoSheet.Cells.Item($Row,14) = [math]::Round(',',$Capacity)

if($dstorefree = ($_.Summary | %{$_.FreeSpace})){

#$serverInfoSheet.Cells.Item($Row,14) = [math]::Round(',',$Capacity)

$serverInfoSheet3.Cells.Item($RowY,15).FormulaR1C1 = "=COUNTIF('VM-Guest Info'!R[1]C[2]:R[3389]C[2],'Host and Datastore'!RC[-3])"


#Connect to first worksheet to rename and make active
$serverInfoSheet2 = $workbook.Worksheets.Item(1)
$serverInfoSheet2.Activate() | Out-Null

#$chart.SeriesCollection(1).DataLabels().Position = 2
#$serverInfoSheet3.ActiveChart.ChartType = xlColumnClustered
#$serverInfoSheet3.ActiveChart.SetSourceData Source:=Range("L5:M30")

#Calculate Collected Statistics for OS Type Spread

#Build Heading
$serverInfoSheet3.Cells.Item(2,18)="GUEST OS"
#Make Bold
$headerRange = $serverInfoSheet3.Range("A1","X2")
#$headerRange.AutoFilter() | Out-Null
$headerRange.EntireColumn.AutoFit() | Out-Null

$serverInfoSheet3.Cells.Item(3,18)="Microsoft Windows"
$serverInfoSheet3.Cells.Item(3,19).FormulaR1C1 = "=COUNTIF('VM-Guest Info'!R4C5:R3889C5,""*Windows*"")"

$serverInfoSheet3.Cells.Item(4,19).FormulaR1C1 = "=COUNTIF('VM-Guest Info'!R4C5:R3889C5,""*Ubuntu*"")"

$serverInfoSheet3.Cells.Item(5,19).FormulaR1C1 = "=COUNTIF('VM-Guest Info'!R4C5:R3889C5,""*Red*Hat*"")"

$serverInfoSheet3.Cells.Item(6,19).FormulaR1C1 = "=COUNTIF('VM-Guest Info'!R4C5:R3889C5,""*Free*BSD*"")"

$serverInfoSheet3.Cells.Item(7,19).FormulaR1C1 = "=COUNTIF('VM-Guest Info'!R4C5:R3889C5,""*Solaris*"")"

$serverInfoSheet3.Cells.Item(8,19).FormulaR1C1 = "=COUNTIF('VM-Guest Info'!R4C5:R3889C5,""*Other*"")"

$chartRange = $serverInfoSheet3.Range(("R2:S8"))

#Chart formula
##Add a chart to the workbook
#Open a sheet for charts
$temp = $excel.Charts.Add()
$chart = $serverInfoSheet2.Shapes.AddChart().Chart

$chartRangeHost = $serverInfoSheet3.Range(("B2:C$lasthostchartrange"))
$charthost = $serverInfoSheet2.Shapes.AddChart().Chart
$charthost.ChartType = -4100
$charthost.HasTitle = $True
$charthost.ChartTitle.Text = "Host Guest Distribution"
$charthost.ApplyLayout(5) | out-Null
$charthost.ChartStyle = 48
$charthost.SeriesCollection(1).ApplyDataLabels() | out-Null
#$charthost.SeriesCollection(1).DataLabels().ShowValue = $True
#$charthost.SeriesCollection(1).DataLabels().Separator = ("{0}" -f [char]10)
#$charthost.SeriesCollection(1).DataLabels().Position = 2

#Datastore Chart
$chartRangedatastore = $serverInfoSheet3.Range(("L2:O$lastdatastorechartrange"))
$chartdatastore = $serverInfoSheet2.Shapes.AddChart().Chart
$chartdatastore.ChartType = 92
$chartdatastore.HasTitle = $True
$chartdatastore.ChartTitle.Text = "Datastore at a glance"
$chartdatastore.ApplyLayout(5) | out-Null
$chartdatastore.ChartStyle = 42
$chartdatastore.SeriesCollection(1).ApplyDataLabels() | out-Null
$chartdatastore.SeriesCollection(2).ApplyDataLabels() | out-Null
$chartdatastore.SeriesCollection(3).ApplyDataLabels() | out-Null
#$chartdatastore.SeriesCollection(1).DataLabels().Separator = ("{0}" -f [char]10)
#$chartdatastore.SeriesCollection(1).DataLabels().Position = 2

#Configure the chart for OS Type Spread
##Use a 3D Pie Chart
$chart.ChartType = 92
$chart.Elevation = 7
$charthost.Elevation = 7
$chartdatastore.Elevation = 7

#Give it some color
#$serverInfoSheet2.Shapes.Item("Chart 2").Fill.ForeColor.TintAndShade = .34
#$serverInfoSheet2.Shapes.Item("Chart 2").Fill.ForeColor.ObjectThemeColor = 5
#$serverInfoSheet2.Shapes.Item("Chart 2").Fill.BackColor.TintAndShade = .765
#$serverInfoSheet2.Shapes.Item("Chart 2").Fill.ForeColor.ObjectThemeColor = 5
#$serverInfoSheet2.Shapes.Item("Chart 2").Fill.TwoColorGradient(1,1)

#Set the location and size of the chart(s)
$serverInfoSheet2.Shapes.Item("Chart 1").Placement = 3
$serverInfoSheet2.Shapes.Item("Chart 1").Top = 30
$serverInfoSheet2.Shapes.Item("Chart 1").Left = 100
$serverInfoSheet2.Shapes.Item("Chart 1").Width = 600
$serverInfoSheet2.Shapes.Item("Chart 1").Height = 200

$serverInfoSheet2.Shapes.Item("Chart 2").Placement = 3
$serverInfoSheet2.Shapes.Item("Chart 2").Top = 240
$serverInfoSheet2.Shapes.Item("Chart 2").Left = 100
$chart2width = ($lasthostchartrange*110)
$serverInfoSheet2.Shapes.Item("Chart 2").Width = $chart2width
$serverInfoSheet2.Shapes.Item("Chart 2").Height = 300

$serverInfoSheet2.Shapes.Item("Chart 3").Placement = 3
$serverInfoSheet2.Shapes.Item("Chart 3").Top = 550
$serverInfoSheet2.Shapes.Item("Chart 3").Left = 100
$chart3width = ($lastdatastorechartrange*140)
$serverInfoSheet2.Shapes.Item("Chart 3").Width = $chart3width
$serverInfoSheet2.Shapes.Item("Chart 3").Height = 450

$chart.HasTitle = $True

$chart.ApplyLayout(5) | out-Null
$chart.ChartTitle.Text = "OS Type Spread"
$chart.ChartStyle = 42
#$chart.PlotVisibleOnly = $False
$chart.SeriesCollection(1).ApplyDataLabels() | out-Null
#$chart.SeriesCollection(1).DataLabels().ShowValue = $True
#$chart.SeriesCollection(1).DataLabels().Separator = ("{0}" -f [char]10)

#$chart.SeriesCollection(1).DataLabels().Position = 2
#$chart.SeriesCollection(1).Points(1).Format.Fill.ForeColor.RGB = 255
#$chart.SeriesCollection(1).Points(2).Format.Fill.ForeColor.RGB = 65535
#$chart.SeriesCollection(1).Points(3).Format.Fill.ForeColor.RGB = 5287936

#Hide the data
#$chartRange.EntireRow.Hidden = $True

Disconnect-VIServer * -Confirm:$false

#Connect to first worksheet to make active
$serverInfoSheet2 = $workbook.Worksheets.Item(1)
$serverInfoSheet2.Activate() | Out-Null

$serverInfoSheet2.Cells.Item(4,17).FormulaR1C1= "=""$vcentername1 "" & ""$vcentername2 "" & ""$vcentername3 "" & ""$vcentername4 "" & ""$vcentername5 "" & ""$vcentername6 "" & ""$vcentername7"""
$sheet1titlerange = $serverInfoSheet2.Range("q4","u4")
$sheet1titlerange.Merge() | Out-Null
$sheet1titlerange.Style = 'Heading 1'

#Release COM Object
[System.Runtime.InteropServices.Marshal]::ReleaseComObject([System.__ComObject]$excel) | Out-Null

So whilst this code works fine, it is a bit slower than I would like, and I would like to port to a html document rather than to excel.
But this will suffice for the moment.

Carving Cheese with a Chainsaw

Some products I tell you, frustrating or what…
Is all this logging really necessary?
This is symantec backup agent running using VACP

I must say if VDR could play nicely with tape drives I would be going down that route in a heartbeat..

This is just a vent as I was trying to consolidate, remove and create some snapshots today and the backups kicked in. This is large environment so there is no stopping backups for the night so we worked through it


Ever so slightly ripped off

In Australia we get absolutly ripped off…

Some examples.

Microsoft Office 2013..
This is a download and a product key, and the craziest thing is you dont know if you are downloading from AU or the US.

AUD – $599

US – $399

$200 dollar profit for um nothing.?


Girls Toddlers Nike Free Run 3

AUD – $70

US – $44

But the winner of the bunch is Dell
Add a 512 SSD Hard Drive to your laptop..

AUD – $1,145.10

USD – $375.00

That is a difference of

Like really?