Skip to content

Commit 2b4ff6c

Browse files
committed
Merge branch 'master' of https://github.com/lamw/vghetto-scripts
2 parents c6fe139 + 5e50a28 commit 2b4ff6c

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

powershell/VMKLinuxDrivers.ps1

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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

Comments
 (0)