-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigure ESXi Network Core Dump.ps1
More file actions
51 lines (41 loc) · 1.74 KB
/
Copy pathConfigure ESXi Network Core Dump.ps1
File metadata and controls
51 lines (41 loc) · 1.74 KB
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
#######################################################################
# Configure ESXi host network core dump
#######################################################################
# Author(s): Corey Blaz
# Github: https://github.com/blazcode
# Web: https://vcorey.com
# Script Configuration
$vCenterFqdn = "vcf-mgmt1-vc1.lab.blaz.tech"
$netDumpServer = "10.0.1.20"
$netDumpPort = 6500
$vmKernelNic = "vmk0"
# No need to edit past here
$creds = Get-Credential
Connect-VIServer -Server $vCenterFqdn -Credential $creds
Write-Host ""
Write-Host "Checking hosts in vCenter: " -ForegroundColor Green -NoNewline
Write-Host $vCenterFqdn -ForegroundColor White
Write-Host ""
foreach ( $vmHost in Get-VMHost) {
Write-Host "Configuring netdump on: " -ForegroundColor Green -NoNewline
Write-Host $vmHost.Name -ForegroundColor White
try {
$esxcli = Get-EsxCli -VMHost $vmHost -V2
# Need to send IP, Port, and interface first
$args = $esxcli.system.coredump.network.set.CreateArgs()
$args.serveripv4 = $netDumpServer
$args.serverport = $netDumpPort
$args.interfacename = $vmKernelNic
$esxcli.system.coredump.network.set.Invoke($args) | Out-Null
# Lastly, enable network core dump
$args = $esxcli.system.coredump.network.set.CreateArgs()
$args.enable = "true"
$esxcli.system.coredump.network.set.Invoke($args) | Out-Null
# Validate network core dump is enabled
Write-Host $esxcli.system.coredump.network.check.Invoke() -ForegroundColor Green
Write-Host ""
} catch {
Write-Host ("ERROR: Failed to configure network core dump on $($vmHost.Name): $_") -ForegroundColor Red
}
}
Disconnect-VIServer -Server $vCenterFqdn -Confirm:$False