vmware: the object has already been deleted or has not been completely created

I’ve been performing loads of storage reclaim tasks all day and notices a few swap files in a datastore that needed to be pulled… so I calmly went ahead and disabled local swap on each ESX host with

esxcli sched swap system set -l false 

and this is all I remember doing as far as destructiveness goes. Perhaps this screwed something up but I digress… it’s too late and I neither have the time or any chance of reverting anything. 

I started getting this error in a cluster from which I pulled the darn swap datastore and reliable google wasn’t much help… I am unable to perform any tasks on VMs including power on, migrate, etc. Everything was fine half an hour ago. I can still power on the VMs through direct fat client connection to each host. Clearly it’s a cluster issue. 

I checked cluster’s swap settings… there you go. It was set to place them in the datastore I just reclaimed. In my case the quickest non-disruptive trick I could pull was to create a new cluster and move my hosts before my boss was back at his desk… so I did. However, I had to make sure to backup my folder structure, annotations, affinity rules, resource pools and vApps backed up before I could do so since I am responsible for a large environment.

1. Create a new cluster and configure
2. Right click – disconnect each host from vCenter
3. Right click – remove from inventory
4. Add hosts to new cluster
5. Attach distributed switches, if any

That’s it, now start restoring, and remember this next time you saw something sitting where it didn’t belong. 

vmware: useful powercli commands

List all LUNs that are not set to Round Robin:
Get-VMHost | Get-ScsiLun -LunType disk | Where {$_.MultipathPolicy -notlike "RoundRobin"}

Set all LUNs that are not set to Round Robin to Round Robin:
Get-VMHost | Get-ScsiLun -LunType disk | Where {$_.MultipathPolicy -notlike "RoundRobin"} | Set-Scsilun -MultiPathPolicy RoundRobin

List all VMs in a cluster:
Get-Cluster "Cluster Name" | Get-VM | Sort Name

List all services running on a host:
Get-VMHost "hostname" | Get-VMHostService | Select Key,Label

List servers with SSH server status:
Get-vmhost | Get-VMHostService | ? {($_.Key -eq "TSM-ssh")} | Select VMHost, Key,Label, Running

List servers with ESXi shell status:
Get-vmhost | Get-VMHostService | ? {($_.Key -eq "TSM")} | Select VMHost, Key,Label, Running

List servers with SSH server status in specific cluster:
Get-Cluster -Name "Non-Production-Pod-01" | get-vmhost | Get-VMHostService | ? {$_.Key -eq "TSM-ssh"} | Select VMHost, Key,Label, Running

Start ESX Shell on all hosts in vCenter:
Get-VMHost | Foreach {
Start-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq "TSM"} | Set-VMHostService -policy "on" -Confirm:$false)
}

Start ssh on all hosts in vCenter:
Get-VMHost | Foreach {
Start-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"} | Set-VMHostService -policy "on" -Confirm:$false)
}

Suppress ssh alert on all hosts in vCenter:
Get-VMHost | Get-AdvancedSetting UserVars.SuppressShellWarning | Set-AdvancedSetting -Value 1

Create VM:
New-VM -RunAsync –name $servername –Datastore $datastore –Template $template –OSCustomizationSpec $spec –ResourcePool $host/resource pool -Location $folder

VMware: System logs are stored on non-persistent storage error during ESXi installation

I am not sure what your circumstances were, but I was using a Mac to RDP to a Windows server to install nested ESXi servers under VMware Workstation.

The culprit was Mac’s way of sending F keys to VMware after a keyboard grab and it switches screens on you. Instead of install page you get the diagnostic message that can be ignored completely. This is not an error, just a warning.

To send the right key to VMware go to your Mac System Preferences, Keyboard and check “Use all F1, F2, yada yada yada”. Then use the Command key + F11 combo. Do not hold any other key. Repeat with other combinations when needed.