VMware Cloud Community
GregorSm
Contributor
Contributor
Jump to solution

How to Disable / Enable a VM's Network Adapter DirectPath I/O Parameter

Hi!

There are examples on the internet on how to get this setting, like

(Get-VM -Name "a-vm-name" | Get-NetworkAdapter).ExtensionData.UptCompatibilityEnabled

but there is none on how to set it. I know I could use Onyx but my vCenter has overtaken it (6.0 --> 6.5). Smiley Happy Maybe I can get a quicker answer here...

Thanks

Gregor

23 Replies
plaman
Enthusiast
Enthusiast
Jump to solution

but it does bring the network adapter  1. 

0 Kudos
LucD
Leadership
Leadership
Jump to solution

I would need to see the code you are using.


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

0 Kudos
plaman
Enthusiast
Enthusiast
Jump to solution

please see below \

$directPath = $false
$nic = (Get-NetworkAdapter -VM $VMname).Name
write-host $nic -ForegroundColor Cyan
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
write-host $spec -ForegroundColor Cyan
$dev = New-Object VMware.Vim.VirtualDeviceConfigSpec
write-host $dev -ForegroundColor Cyan
$dev.Operation = [VMware.Vim.VirtualDeviceConfigSpecOperation]::edit
write-host $dev.Operation -ForegroundColor Cyan
$dev.Device = [VMware.Vim.VirtualDevice]$nic.ExtensionData
write-host $dev.Device  -ForegroundColor Cyan
$dev.Device.UptCompatibilityEnabled = $directPath
$spec.DeviceChange += $dev
$VMname.ExtensionData.ReconfigVM($spec)

 

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Does that VM have more than 1 vNIC?
In that case, that snippet will not work I'm afraid.

Also, there are a couple of errors in there.
You populate the $nic variable with the name of the vNIC(s).
Then you use $nic.ExtensionData, which doesn't exist.


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

0 Kudos