# Define list of nodes to check
$servers = Get-Content -Path "C:\TEMP\AllNodes.txt"
# Query activation status
foreach ($server in $servers) {
$activation = Get-WmiObject -Query "SELECT * FROM SoftwareLicensingProduct WHERE (PartialProductKey IS NOT NULL)" -ComputerName $server
if ($activation) {
Write-Host "Server $server is activated."
} else {
Write-Host "Server $server is not activated."
}
}