Hello,
I currently have a security lab setup which requires a VM to use a PCI passthrough network card. It takes me about an hour and a half to reset a lab for each person every week. I've decided to try to automate this but am haveing problems figuring out what the unique ID of the PCI passthrough device in powershell. I'm able to attach to the nic without a problem in vsphere 5.1 but have yet to be able to attach it in powershell. Here is an example of what I'm doing.
New-VApp -Name SPod8 -Location (VMHost 10.10.10.100) -vApp (Get-VApp GoldMasterv5) -Datastore DC2store
In vsphere I would simply attach a pci pass-through for each server.
Modify HQ-SRV network port
-Add a pci passthrough
-Select 03:00.3 pci card
Modify Employee-PC
-Add a pci passthrough
-Select 0a:00.0
Modify Guest-PC
-Add a pci passthrough
-Select 0a:00.1
Some of the commands I’ve run and attempted to use are as follows:
**This did not work complained about the device ID.**
Add-PassThroughDevice 10.10.10.100 -VM Guest-PC –ID 0a:00.0
**Brings up names of PCI devices but not unique assignable port id’s none that will work with the command add-passthroughdevice id
Get-vmhost 10.10.10.100 | get-passthroughdevice
PowerCLI C:\> Get-PassthroughDevice -VMHost 10.10.10.100
Key Name VendorName Type
--- ---- ---------- ----
I350 Gigabit Network Connec... Intel Corporation Pci
82580 Gigabit Network Conne... Intel Corporation Pci
C600/X79 series chipset USB... Intel Corporation Pci
C600/X79 series chipset USB... Intel Corporation Pci
Patsburg 4 port SATA IDE Co... Intel Corporation Pci
iLO4 Hewlett-Packard Company Pci
Smart Array P420i Hewlett-Packard Company Pci
NetXtreme II BCM57810 10 Gi... Broadcom Corporation Pci
So I tried it with a variable but I need to figure out how to specify only one VAPP on the specific VMHost to execute the command. It appears to want to apply it to all the Guest-PC’s on all vmhosts and in all vapps.
$pcicard = Get-PassthroughDevice -VMHost 10.10.10.100 -Type Pci
PowerCLI C:\> Add-PassThroughDevice -VM Guest-PC -PassthroughDevice $pcicard[1] -Whatif
What if: Add passthrough device '82580 Gigabit Network Connection' to VM 'Guest-PC'.
What if: Add passthrough device '82580 Gigabit Network Connection' to VM 'Guest-PC'.
What if: Add passthrough device '82580 Gigabit Network Connection' to VM 'Guest-PC'.
What if: Add passthrough device '82580 Gigabit Network Connection' to VM 'Guest-PC'.
What if: Add passthrough device '82580 Gigabit Network Connection' to VM 'Guest-PC'.
What if: Add passthrough device '82580 Gigabit Network Connection' to VM 'Guest-PC'.
What if: Add passthrough device '82580 Gigabit Network Connection' to VM 'Guest-PC'.
What if: Add passthrough device '82580 Gigabit Network Connection' to VM 'Guest-PC'.
What if: Add passthrough device '82580 Gigabit Network Connection' to VM 'Guest-PC'.
What if: Add passthrough device '82580 Gigabit Network Connection' to VM 'Guest-PC'.
What if: Add passthrough device '82580 Gigabit Network Connection' to VM 'Guest-PC'.
What if: Add passthrough device '82580 Gigabit Network Connection' to VM 'Guest-PC'.
What if: Add passthrough device '82580 Gigabit Network Connection' to VM 'Guest-PC'.
PowerCLI C:\>
At this point i'm questioning how to pipline this command to just the one vapp and on only the vmhost 10.10.10.100 or if there is some easier way to do this via powercli.