Powershell to the rescue – Setting MTU size on a vmkernel port

During an implementation of Cisco UCS – one of the vmkernel ports on a standard switch was acting funny – it wasn’t getting set to the desired  MTU of 9000.  What made it odd is other kernel ports on that same switch were setting themselves correctly.  To resolve this – PowerShell to the rescue.  A quick search of google lead me to a post by Martijn Smit.  His blog post came in very handy as it provided the context of setting MTU for either a port group a vSwitch  or a standard switch.  In my case I was only worried about setting it on a VMKernel port.

From your vcenter you can capture the appropriate vmk port you need to set.  From PowerCLI

$vmkernel = GetVMHostNetworkAdapter Name vmk0 VMHost (GetVMHost Name esxi01.lab.local)
SetVMHostNetworkAdapter VirtualNic $vmkernel MTU 9000
Advertisements

Determine ESXi / ESX host versions

How often are you looking to see if all your ESX hosts are at the same revision level?  Did one get left behind, or did someone run odd updates against one and you are trying to figure out the out one out?

This is very easy to find via PowerCLI.  Once you are authenticated to one or many vcenter instances (connect-viserver) you can run one of the following commands – it really depends how much data you want to capture.

getview ViewType HostSystem -Property Name,Config.Product | select Name,{$_.Config.Product.FullName}
This will give you output similar to:
Name $_.Config.Product.FullName
—- ————————–
mnepesx35p.corporate.ltcg.com VMware ESXi 6.0.0 build-3825889
mnepesx22-p.corporate.ltcg.com VMware ESXi 6.0.0 build-3825889

or

getview ViewType HostSystem -Property Name,Config.Product | foreach {$_.Name, $_.Config.Product}
This will give you output similar to:
Name : VMware ESXi
FullName : VMware ESXi 6.0.0 build-3825889
Vendor : VMware, Inc.
Version : 6.0.0
Build : 3825889
LocaleVersion : INTL
LocaleBuild : 000
OsType : vmnix-x86
ProductLineId : embeddedEsx
ApiType : HostAgent
ApiVersion : 6.0
InstanceUuid :
LicenseProductName : VMware ESX Server
LicenseProductVersion : 6.0

Both could be tagged with a >filename at the end if you wish to save to a file versus output to the console screen.

 



Credit to vmdev.info’s post found here.