Fix activation check
This commit is contained in:
@@ -27,13 +27,11 @@ function CheckOfficeInstall {
|
||||
}
|
||||
|
||||
function CheckActivation {
|
||||
$osLicense = Get-CimInstance -ClassName SoftwareLicensingProduct | Where-Object { $_.Description -match "Windows" }
|
||||
$officeLicense = Get-CimInstance -ClassName SoftwareLicensingProduct | Where-Object { $_.Description -match "Office" }
|
||||
$windows = $osLicense.Description
|
||||
$office = $officeLicense.Description
|
||||
$osLicense = Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Windows%'" | where { $_.PartialProductKey } | select Description, LicenseStatus
|
||||
$officeLicense = Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Office%'" | where { $_.PartialProductKey } | select Description, LicenseStatus
|
||||
|
||||
# if both activated return true
|
||||
if ($osLicense.LicenseStatus -eq 1 -and $officeLicense.LicenseStatus -eq 1) {
|
||||
if ($osLicense.LicenseStatus -eq 1 -and $officeLicense.LicenseStatus -eq 2) {
|
||||
Write-Host "Windows and Office are activated."
|
||||
return $true
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user