#remediate Invoke-Command -Scriptblock { cscript C:\Windows\System32\slmgr.vbs -upk cscript C:\Windows\System32\slmgr.vbs -ipk MMFTT-7FBRY-W9QYW-37FMB-TRPJK cscript C:\Windows\System32\slmgr.vbs -ato 553673ed-6ddf-419c-a153-b760283472fd } # Discovery $Compliant = $false $ActivationString = Invoke-Command -Scriptblock { cscript C:\Windows\System32\slmgr.vbs -xpr } -Session $x If ($ActivationString -like "Windows(R) 7, Server-ESU-Year1 edition*" -and $ActivationString -like "*The machine is permanently activated.*") { $Compliant = $true } else { $Compliant = $false } $Compliant