VMware Cloud Community
Jungo83
Contributor
Contributor

Enable passthrough for Graphic cards through PowerCli

Hello

I'm trying to find a way to enable 2 Graphic Cards I have on the host for passthrough so I can use them in the VMs

I'm familiar with the GUI way to do it and it works, but I want to include it in a host configuration script I build

I looked at this link and it looks like there is a way. However, when I try to manipulate it to my needs I'm falling short...

Anyone had any luck with making this work?

Thanks,

Omer

0 Kudos
3 Replies
LucD
Leadership
Leadership

Did you already look at Alan's ADDING A VGPU FOR A VSPHERE 6.0 VM VIA POWERCLI post?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Jungo83
Contributor
Contributor

Hi LucD‌, thank you

Looking at the code, it looks close to what I need, but not exactly

The article describes how to add the GPU to a VM. There is a step before it to enable the device for passthrough. This is the step I'm looking to automate

I looked through the code and I don't see this step described there.

Any other suggestions?

Thanks,

Omer

0 Kudos
gajuambi
Enthusiast
Enthusiast

$oTMP.VIEW=Get-View -Server $VMH -ViewType HostSystem -Property Summary,Config,ConfigManager

  $oTMP.SPEC=Get-View -Server $VMH -Id $oTMP.VIEW.ConfigManager.PciPassthruSystem

  IF($oTMP.TMP=$oTMP.VIEW.Config.StorageDevice.HostBusAdapter | ?{$_.Model -match "H800"}){

  ($oTMP.SPEC.PciPassthruInfo | ?{$_.id -eq $oTMP.TMP.PCI}).PassthruEnabled=$false

  $oTMP.TMP.Model+': PassthruEnabled='+(($oTMP.SPEC.PciPassthruInfo | ?{$_.id -eq $oTMP.TMP.PCI}).PassthruEnabled)

  }

Apparently this works (https://www.reddit.com/r/vmware/comments/3datxd/powercli_way_to_enable_pcie_passthrough/ )

I am unable to decipher it properly. May be you can and get this working and hopefully you can share that with us too.

---------------------- Gajendra D Ambi [pardon my chat lingo]
0 Kudos