Try this PS Script:
# Get activation status
$activationStatus = Get-CimInstance -Query "SELECT * FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL AND LicenseStatus = 1"
# Evaluate activation and return appropriate status
if ($activationStatus) {
Write-Output "Windows is activated."
exit 0 # Healthy
} else {
Write-Output "Windows is NOT activated."
exit 1 # Unhealthy
}
------------------------------
Shpat | ACEP | ACMP | ACCP | ACDP
Just an Aruba enthusiast and contributor by cases
If you find my comment helpful, KUDOS are appreciated.
------------------------------
Original Message:
Sent: May 19, 2025 06:47 PM
From: mohanad.abdalrazik@outlook.com
Subject: OnGuard Health Collection Scripts
Hi everyone,
i have a task to configure Health Collection Script to check if the windows activated or not, based on the returned value user will be healthy or not.
this is PowerShell script
# Get activation status
$activationStatus = Get-CimInstance -Query "Select * from SoftwareLicensingProduct where PartialProductKey is not null and LicenseStatus = 1"
# Build output message
if ($activationStatus) {
$output = @{ activationStatus = "Windows is activated." }
} else {
$output = @{ activationStatus = "Windows is NOT activated." }
}
# Convert to JSON
$output | ConvertTo-Json


access tracker logs:



what im missing? because "activationStatus" parameter not returned to ClearPass, i tried to run the script manually it's working successfully
I'm also confused because the exit code is 0 which means

------------------------------
BR,
Mohanad
------------------------------