Files
loc_az_hci/infrastructure/drivers/verify-drivers.ps1
defiQUG c39465c2bd
Some checks failed
Test / test (push) Has been cancelled
Initial commit: loc_az_hci (smom-dbis-138 excluded via .gitignore)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 09:04:46 -08:00

147 lines
5.9 KiB
PowerShell

# Verify Driver Installation and Health
# Checks all drivers: Intel NICs, LSI HBAs, Intel QAT
param(
[switch]$Detailed = $false
)
$ErrorActionPreference = "Continue"
Write-Host "=========================================" -ForegroundColor Cyan
Write-Host "Driver Verification and Health Check" -ForegroundColor Cyan
Write-Host "=========================================" -ForegroundColor Cyan
# Check if running as Administrator
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
Write-Host "Warning: Not running as Administrator. Some checks may be limited." -ForegroundColor Yellow
}
$allHealthy = $true
# Check Intel NICs
Write-Host "`n[1/3] Checking Intel Network Adapters..." -ForegroundColor Yellow
$intelNics = Get-NetAdapter | Where-Object { $_.InterfaceDescription -like "*Intel*" }
if ($intelNics.Count -eq 0) {
Write-Host " No Intel network adapters found." -ForegroundColor Red
$allHealthy = $false
}
else {
Write-Host " Found $($intelNics.Count) Intel adapter(s):" -ForegroundColor Green
foreach ($nic in $intelNics) {
$driverInfo = Get-NetAdapterDriver -Name $nic.Name -ErrorAction SilentlyContinue
$status = $nic.Status
$linkSpeed = $nic.LinkSpeed
$statusColor = if ($status -eq "Up") { "Green" } else { "Red" }
Write-Host " $($nic.Name):" -ForegroundColor White
Write-Host " Status: $status" -ForegroundColor $statusColor
Write-Host " Link Speed: $linkSpeed" -ForegroundColor White
Write-Host " Driver: $($driverInfo.DriverVersion)" -ForegroundColor White
if ($status -ne "Up") {
$allHealthy = $false
}
if ($Detailed) {
$nicDetails = Get-NetAdapterStatistics -Name $nic.Name -ErrorAction SilentlyContinue
if ($nicDetails) {
Write-Host " Bytes Sent: $($nicDetails.SentBytes)" -ForegroundColor Gray
Write-Host " Bytes Received: $($nicDetails.ReceivedBytes)" -ForegroundColor Gray
}
}
}
}
# Check LSI HBAs
Write-Host "`n[2/3] Checking LSI Storage Controllers..." -ForegroundColor Yellow
$lsiControllers = Get-PnpDevice | Where-Object {
$_.FriendlyName -like "*LSI*" -or
$_.FriendlyName -like "*SAS2308*" -or
$_.FriendlyName -like "*9207*"
}
if ($lsiControllers.Count -eq 0) {
Write-Host " No LSI storage controllers found." -ForegroundColor Yellow
Write-Host " Note: This may be normal if running on Linux or controllers not installed." -ForegroundColor Gray
}
else {
Write-Host " Found $($lsiControllers.Count) LSI controller(s):" -ForegroundColor Green
foreach ($controller in $lsiControllers) {
$status = $controller.Status
$statusColor = if ($status -eq "OK") { "Green" } else { "Red" }
Write-Host " $($controller.FriendlyName):" -ForegroundColor White
Write-Host " Status: $status" -ForegroundColor $statusColor
if ($status -ne "OK") {
$allHealthy = $false
}
}
}
# Check Intel QAT
Write-Host "`n[3/3] Checking Intel QAT Card..." -ForegroundColor Yellow
$qatDevices = Get-PnpDevice | Where-Object {
$_.FriendlyName -like "*QAT*" -or
$_.FriendlyName -like "*QuickAssist*" -or
$_.FriendlyName -like "*8970*"
}
if ($qatDevices.Count -eq 0) {
Write-Host " No Intel QAT devices found." -ForegroundColor Yellow
Write-Host " Note: This may be normal if running on Linux or QAT card not installed." -ForegroundColor Gray
}
else {
Write-Host " Found $($qatDevices.Count) QAT device(s):" -ForegroundColor Green
foreach ($device in $qatDevices) {
$status = $device.Status
$statusColor = if ($status -eq "OK") { "Green" } else { "Red" }
Write-Host " $($device.FriendlyName):" -ForegroundColor White
Write-Host " Status: $status" -ForegroundColor $statusColor
if ($status -ne "OK") {
$allHealthy = $false
}
}
}
# Linux-specific checks (if running on Linux via WSL or remote)
Write-Host "`nLinux System Checks (if applicable):" -ForegroundColor Yellow
Write-Host " Run these commands on Linux systems:" -ForegroundColor White
Write-Host " lspci | grep -i network # Check NICs" -ForegroundColor Gray
Write-Host " lspci | grep -i storage # Check HBAs" -ForegroundColor Gray
Write-Host " lspci | grep -i qat # Check QAT" -ForegroundColor Gray
Write-Host " lsmod | grep igb # Check Intel NIC driver" -ForegroundColor Gray
Write-Host " lsmod | grep mpt3sas # Check LSI HBA driver" -ForegroundColor Gray
Write-Host " lsmod | grep qat # Check QAT driver" -ForegroundColor Gray
Write-Host " qat_service status # Check QAT service" -ForegroundColor Gray
# Summary
Write-Host "`n=========================================" -ForegroundColor Cyan
if ($allHealthy) {
Write-Host "Driver Health Check: PASSED" -ForegroundColor Green
}
else {
Write-Host "Driver Health Check: FAILED" -ForegroundColor Red
Write-Host "Some drivers or devices are not functioning properly." -ForegroundColor Yellow
}
Write-Host "=========================================" -ForegroundColor Cyan
# Recommendations
Write-Host "`nRecommendations:" -ForegroundColor Yellow
Write-Host "1. Ensure all hardware is properly installed" -ForegroundColor White
Write-Host "2. Verify drivers are up to date" -ForegroundColor White
Write-Host "3. Check device manager for any errors" -ForegroundColor White
Write-Host "4. Review system logs for driver-related errors" -ForegroundColor White
Write-Host "5. Test network connectivity for NICs" -ForegroundColor White
Write-Host "6. Verify storage shelves are detected for HBAs" -ForegroundColor White
Write-Host "7. Test QAT acceleration if QAT is installed" -ForegroundColor White
exit $(if ($allHealthy) { 0 } else { 1 })