Last month we ran into an issue where VMs were failing vmotion (that was kicked off DRS or otherwise).
The issue seems to occur when the VM has multiple vmx-*.vswp files.
There should only be one file, but for whatever reason (weird HA stuff) a phantom file is created that is there but is not in use.
During the vMotion, it tries to validte both vmx-*.vswp files and chokes since one is there but not really in use.
The fix is to try to rename both files and the one that renames is the bad one.
Below is a script to create a csv file of VMs that have more than one vmx*vswp file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
$vCenter=name $datacenter=dc if (( Get-PSSnapin -name Vmware.Vimautomation.core -ErrorAction SilentlyContinue ) -eq $null ) { Add-PSSnapin vmware.vimautomation.core } Connect-VIServer $vCenter $allds=dir -path vmstore:\$datacenter\ | select name #this should be all datastores $mastervmx= @() foreach ($myds in $allds) { if($myds.name -notlike "*.snapshot*") { $myds2=$myds.name $vmfolders=dir -Path vmstore:\$datacenter\$myds2| select name foreach ($vmfolder in $vmfolders) { if(($vmfolder.name -notlike ".*") -and ($vmfolder.Name -notlike "*q_01*")) { $vmfolder2=$vmfolder.name $vmxs=dir -Path vmstore:\$datacenter\$myds2\$vmfolder2 | select name,datastorefullpath,lastwritetime | Where-Object {$_.name -like "vmx*vswp"} if ($vmxs.count -gt 1) { foreach ($vmx in $vmxs) { $mastervmx+=$vmx } } } } } } $mastervmx|Export-Csv -NoTypeInformation -UseCulture -Path C:\temp\$vcenter-vmxinfo.csv Disconnect-viserver -confirm:$false |