slzl1977
Contributor
Contributor

PowerCLI vSphere 6.7 - Adding VMs to Inventory Causes vCenter Services to Crash

Hello,

We have been essentially the following script searching through 25 datastores in a datastore cluster and adding to inventory.  We notcied that this causes the vCenter services to crash out.  Has anyone else come across this issue?  VMware Support have suggested we are overloading vCenter (although this has worked perfectly fine on older versions)

My thinking is to remove the -RunAsSync parameter to let the task complete before moving on to the next, and also in the foreach loop for adding the VM, go a Get-VMHost | Get-Random and adding the -VMHost parameter to the New-VM command.

Any assistance / advice / thoughts would be greatly appreciated.

Thanks.

$clusterdatastores = Get-DatastoreCluster $storagecluster | Get-Datastore
foreach($clusterdatastore in $clusterdatastores) {
# Set up Search for .VMX Files in Datastore Cluster
$ds = Get-Datastore -Name $clusterdatastore | %{Get-View $_.Id}
$SearchSpec = New-Object VMware.Vim.HostDatastoreBrowserSearchSpec
$SearchSpec.matchpattern = "*.vmx"
$dsBrowser = Get-View $ds.browser
$DatastorePath = "[" + $ds.Summary.Name + "]"

# Find all .VMX file paths in Datastore variable and filters out .snapshot
$SearchResult = $dsBrowser.SearchDatastoreSubFolders($DatastorePath, $SearchSpec) | where {$_.FolderPath -notmatch ".snapshot"} | %{$_.FolderPath + ($_.File | select Path).Path}

# Register all .VMX files with vCenter
foreach($VMXFile in $SearchResult) {
New-VM -VMFilePath $VMXFile -Location $VMFolder -ResourcePool $vmresourcepool -RunAsync | Out-Null
}
}

0 Kudos
1 Reply
slzl1977
Contributor
Contributor

As a an update, if a VM you want to be imported has a content library item mounted, this will cause the vCenter services to crash out.  Following error was seen in the vCenter logs:

2018-11-08T15:53:08.646Z error vpxd[31920] [Originator@6876 sub=Default opID=3903c8f4-01-1159de75] [Vdb::VdbField] Invalid value written to column DEVICE_INFO_SUMMARY in table VPX_VM_VIRTUAL_DEVICE

2018-11-08T15:53:08.646Z error vpxd[31920] [Originator@6876 sub=Default opID=3903c8f4-01-1159de75] [Vdb::VdbField] String too large: 516 > max(510)

2018-11-08T15:53:08.646Z error vpxd[31920] [Originator@6876 sub=Default opID=3903c8f4-01-1159de75] [VdbStatement::Execute]Bind parameters have different batch size

0 Kudos