-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Get-NICDetails.psm1
93 lines (73 loc) · 2.62 KB
/
Get-NICDetails.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
function Get-NICDetails {
<#
.NOTES
===========================================================================
Created by: Markus Kraus
Twitter: @VMarkus_K
Private Blog: mycloudrevolution.com
===========================================================================
Changelog:
2017.02 ver 1.0 Base Release
===========================================================================
External Code Sources:
-
===========================================================================
Tested Against Environment:
vSphere Version: ESXi 6.0 U2, ESXi 6.5
PowerCLI Version: PowerCLI 6.3 R1, PowerCLI 6.5 R1
PowerShell Version: 4.0, 5.0
OS Version: Windows 8.1, Server 2008 R2, Server 2012 R2
Keyword: ESXi, NIC, vmnic, Driver, Firmware
===========================================================================
.DESCRIPTION
Reports Firmware and Driver Details for your ESXi vmnics.
.Example
Get-NICDetails -Clustername *
.PARAMETER Clustername
Name or Wildcard of your vSphere Cluster Name to process.
#Requires PS -Version 4.0
#Requires -Modules VMware.VimAutomation.Core, @{ModuleName="VMware.VimAutomation.Core";ModuleVersion="6.3.0.0"}
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$True, ValueFromPipeline=$False, Position=0)]
[ValidateNotNullorEmpty()]
[String] $Clustername
)
Begin {
$Validate = $True
if (($myCluster = Get-Cluster -Name $Clustername).count -lt 1) {
$Validate = $False
thow "No Cluster '$myCluster' found!"
}
}
Process {
$MyView = @()
if ($Validate -eq $True) {
foreach ($myVMhost in ($myCluster | Get-VMHost)) {
$esxcli2 = Get-ESXCLI -VMHost $myVMhost -V2
$niclist = $esxcli2.network.nic.list.invoke()
$nicdetails = @()
foreach ($nic in $niclist) {
$args = $esxcli2.network.nic.get.createargs()
$args.nicname = $nic.name
$nicdetail = $esxcli2.network.nic.get.Invoke($args)
$nicdetails += $nicdetail
}
ForEach ($nicdetail in $nicdetails){
$NICReport = [PSCustomObject] @{
Host = $myVMhost.Name
vmnic = $nicdetail.Name
LinkStatus = $nicdetail.LinkStatus
BusInfo = $nicdetail.driverinfo.BusInfo
Driver = $nicdetail.driverinfo.Driver
FirmwareVersion = $nicdetail.driverinfo.FirmwareVersion
DriverVersion = $nicdetail.driverinfo.Version
}
$MyView += $NICReport
}
}
$MyView
}
}
}