Testing Windows activation from PowerShell involves a little dive into CIM (WMI).
At its simplest a function like this
function test-activation {
$ta = Get-CimInstance -ClassName SoftwareLicensingProduct -Filter "PartialProductKey IS NOT NULL" … Read the full text.