PowerCLI

 View Only
  • 1.  Enable PCI Passthrough for NIC cards?

    Posted Jun 06, 2024 10:15 AM

    Cant figure out how to toggle/enable PCI Passthrough capable physical NICs.  I found this thread:

    Automation

    Broadcom remove preview
    Automation
    HelloI'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 VMsI'm familiar with the GUI way to do it an
    View this on Broadcom >

    But cant make sense of what is needed to enable PCI Passthrough.

    Thanks,

    -MattG



  • 2.  RE: Enable PCI Passthrough for NIC cards?

    Posted Jun 06, 2024 10:41 AM
    Edited by LucD Jun 06, 2024 04:41 PM

    You need to know the Id of the device, then you could do something like this

    $esxName = 'MyEsx'
    $tgtDevice = 'bus:slot.function'
    
    $esx = Get-VMHost -Name $esxName
    $dev = $esx.ExtensionData.Config.PciPassthruInfo | where{$_.Id -eq $tgtDevice}
    
    $pciPass = Get-View -Id $esx.ExtensionData.ConfigManager.pciPassthruSystem
    $pci = New-Object -TypeName VMware.Vim.HostPciPassthruConfig
    $pci.ApplyNow = $true
    $pci.PassthruEnabled = $true
    $pci.Id = $dev.Id
    
    $pciPass.UpdatePassthruConfig(@($pci))



    ------------------------------


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


    ------------------------------



  • 3.  RE: Enable PCI Passthrough for NIC cards?

    Posted Jun 06, 2024 02:05 PM

    Lucd,

    THANKS as always!  

    I had to change:

    $pciPass.UpdatePassthruConfig(@($config))

    to

    $pciPass.UpdatePassthruConfig(@($pci))

    -MattG




  • 4.  RE: Enable PCI Passthrough for NIC cards?

    Posted Jun 06, 2024 04:42 PM

    Oops, typo.
    I corrected the code above.



    ------------------------------


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


    ------------------------------