|
# Check ESU requirements |
|
|
|
Write-Host "" # Separator |
|
|
|
###################################################################### |
|
# OS details |
|
$sysInfoCsv = SystemInfo /fo csv |
|
$sysInfo = ConvertFrom-Csv $sysInfoCsv |
|
|
|
Write-Host "Hostname: " $sysInfo."Host Name" |
|
Write-Host "OS name: " $sysInfo."OS Name" |
|
|
|
# Windows Server Licence activation |
|
$activationState = (Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Windows%'" | |
|
where { $_.PartialProductKey }).LicenseStatus |
|
if ($activationState -eq 1) { |
|
Write-Host -ForegroundColor green " Windows is properly activated" |
|
} else { |
|
Write-Host -ForegroundColor Yellow " Windows is not activated" |
|
} |
|
Write-Host "" # Separator |
|
|
|
# Arc Agent state |
|
$ArcAgentStatusData = Invoke-WebRequest -Uri "http://localhost:40342/agentstatus" | ConvertFrom-Json |
|
Write-Host "Agent version: " $ArcAgentStatusData.agentVersion |
|
Write-Host "Agent state: " $ArcAgentStatusData.status |
|
if ($ArcAgentStatusData.error) { |
|
Write-Host -ForegroundColor Yellow "Error: " $ArcAgentStatusData.error |
|
} |
|
Write-Host "" # Separator |
|
|
|
###################################################################### |
|
# Check installed KBs |
|
function look_for_kb { |
|
param ( |
|
$KBId |
|
) |
|
$kb_installed = Get-HotFix -Id $KBId -ErrorAction SilentlyContinue |
|
if ($null -eq $kb_installed) { |
|
Write-Host -ForegroundColor Yellow " $KBId is not installed on this server" |
|
} else { |
|
Write-Host -ForegroundColor Green " $KBId is installed" |
|
} |
|
} |
|
|
|
###################################################################### |
|
# ESU Pre-requisites |
|
if ($sysInfo."OS Name".Contains("2012 R2")) { |
|
Write-Host "Looking for 2012 R2 pre-requisites" |
|
Write-Host " Checking: Servicing stack update (SSU)... " -NoNewline |
|
look_for_kb KB5029368 |
|
Write-Host " Checking: Licensing Preparation Package..." -NoNewline |
|
look_for_kb KB5017220 |
|
} else { |
|
if ($sysInfo."OS Name".Contains("2012")) { |
|
Write-Host "Looking for 2012 pre-requisites" |
|
Write-Host " Checking: Servicing stack update (SSU)... " -NoNewline |
|
look_for_kb KB5029369 |
|
Write-Host " Checking: Licensing Preparation Package..." -NoNewline |
|
look_for_kb KB5017221 |
|
} else { |
|
Write-Warning "Non 2012 server" |
|
} |
|
} |
|
Write-Host "" # Separator |
|
|
|
###################################################################### |
|
# Test november ESU upgrades |
|
Write-Host "Looking for November released ESU" |
|
if ($sysInfo."OS Name".Contains("2012 R2")) { |
|
Write-Host " Checking: Security Monthly Quality Rollup..." -NoNewline |
|
look_for_kb KB5032249 |
|
Write-Host " Checking: Servicing stack update (SSU)... " -NoNewline |
|
look_for_kb KB5032308 |
|
} else { |
|
if ($sysInfo."OS Name".Contains("2012")) { |
|
Write-Host " Checking: Security Monthly Quality Rollup..." -NoNewline |
|
look_for_kb KB5032247 |
|
Write-Host " Checking: Servicing stack update (SSU)... " -NoNewline |
|
look_for_kb KB5032309 |
|
} else { |
|
Write-Warning "Non 2012 server" |
|
} |
|
} |
|
|
|
|
|
Write-Host "" # Separator |
|
###################################################################### |
|
# Test certificate |
|
|
|
$certSubject = "CN=Microsoft Azure TLS Issuing CA 01, O=Microsoft Corporation, C=US" |
|
$certThumbprint = "2f2877c5d778c31e0f29c7e371df5471bd673173".ToUpper() |
|
|
|
Write-Host "Checking certificate: " $certSubject |
|
$actualThumb = Get-ChildItem -path Cert:\* -Recurse | where {$_.Subject -eq $certSubject} | Select-Object Thumbprint |
|
if ($null -eq $actualThumb) { |
|
Write-Host -ForegroundColor Yellow "Microsoft Azure TLS Issuing CA 01 - Certificate not found" |
|
} else { |
|
if ($actualThumb.Thumbprint.ToUpper() -eq $certThumbprint) { |
|
Write-Host -ForegroundColor Green " Microsoft Azure TLS Issuing CA 01 - Certificate is valid" |
|
} else { |
|
Write-Host -ForegroundColor Yellow " Microsoft Azure TLS Issuing CA 01 - Certificate is not valid" |
|
} |
|
} |
|
|
|
Write-Host "" # Separator |
|
###################################################################### |
|
# Test ESU enablement |
|
|
|
if (Test-Path "./ArcESUEnabled.ps1" -PathType leaf) |
|
{ |
|
./ArcESUEnabled.ps1 |
|
} else { |
|
Write-Warning "ArcESUEnabled.ps1 not found: you can download it from: https://raw.githubusercontent.com/nitinbps/ArcforServerSamples/main/ArcESUEnabled.ps1" |
|
} |