1
+ Function Get-VMKLinuxDrivers {
2
+ <#
3
+ . NOTES
4
+ ===========================================================================
5
+ Created by: William Lam
6
+ Organization: VMware
7
+ Blog: www.virtuallyghetto.com
8
+ Twitter: @lamw
9
+ ===========================================================================
10
+ . DESCRIPTION
11
+ This function returns the list of ESXi hosts within a vSphere Cluster
12
+ that is currently has VMklinux Drivers in use and the list of drivers
13
+ . PARAMETER Cluster
14
+ The name of a vSphere Cluster to analyze
15
+ . EXAMPLE
16
+ Get-VMKLinuxDrivers -Cluster Cluster-01
17
+ #>
18
+ param (
19
+ [Parameter (Mandatory = $true )][string ]$Cluster
20
+ )
21
+
22
+ $vmhosts = Get-Cluster $Cluster | Get-VMHost | where {$_.ConnectionState -eq " Connected" }
23
+
24
+ $results = @ ()
25
+ foreach ($vmhost in $vmhosts | Sort-Object - Property name) {
26
+ Write-Host " Checking $ ( $vmhost.name ) ..."
27
+ $esxcli = Get-EsxCli - VMHost $vmhost - V2
28
+ $modules = $esxcli.system.module.list.Invoke () | where {$_.IsLoaded -eq $true }
29
+ $vmklinuxDrivers = @ ()
30
+ foreach ($module in $modules ) {
31
+ $moduleName = $esxcli.system.module.get.CreateArgs ()
32
+ $moduleName.module = $module.name
33
+ $vmkernelModule = $esxcli.system.module.get.Invoke ($moduleName )
34
+
35
+ if ($vmkernelModule.RequiredNamespaces -match " com.vmware.driverAPI" ) {
36
+ $vmklinuxDrivers += $module.name
37
+ }
38
+ }
39
+
40
+ if ($vmklinuxDrivers -ne $null ) {
41
+ $tmp = [pscustomobject ] @ {
42
+ VMHost = $vmhost.name ;
43
+ VMKLinuxDriver = ($vmklinuxDrivers -join " ," )
44
+ }
45
+ $results += $tmp
46
+ }
47
+ }
48
+ $results | Sort-Object - Property VMHost | FT
49
+ }
0 commit comments