summaryrefslogtreecommitdiff
path: root/MAS/Separate-Files-Version/Check-Activation-Status-wmi.cmd
diff options
context:
space:
mode:
authorDESKTOP-AJSJJMA\Admin2022-11-07 20:33:01 +0000
committerDESKTOP-AJSJJMA\Admin2022-11-07 20:33:01 +0000
commitbc8ae03488691ce45752774cc4350a5e6e11cd33 (patch)
tree36a3090e4ee09ae86ededf0d18d448734a1a80bf /MAS/Separate-Files-Version/Check-Activation-Status-wmi.cmd
parentd17d7496e0f8c0fc80b97f42cfd4bb4e1008a8a5 (diff)
downloadMicrosoft-Activation-Scripts-bc8ae03488691ce45752774cc4350a5e6e11cd33.zip
1.7
Diffstat (limited to 'MAS/Separate-Files-Version/Check-Activation-Status-wmi.cmd')
-rw-r--r--MAS/Separate-Files-Version/Check-Activation-Status-wmi.cmd22
1 files changed, 13 insertions, 9 deletions
diff --git a/MAS/Separate-Files-Version/Check-Activation-Status-wmi.cmd b/MAS/Separate-Files-Version/Check-Activation-Status-wmi.cmd
index 6e9e948..ea350f0 100644
--- a/MAS/Separate-Files-Version/Check-Activation-Status-wmi.cmd
+++ b/MAS/Separate-Files-Version/Check-Activation-Status-wmi.cmd
@@ -72,8 +72,7 @@ if not %errorlevel%==0 (
echo:
echo Error: This is not a correct file. It has LF line ending issue.
echo:
-echo Press any key to exit...
-pause >nul
+ping 127.0.0.1 -n 6 > nul
popd
exit /b
)
@@ -362,7 +361,7 @@ exit /b
function PrintModePerPridFromRegistry
{
$vNextRegkey = "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Licensing\LicensingNext"
- $vNextPrids = Get-Item -Path $vNextRegkey -ErrorAction Ignore | Select-Object -ExpandProperty 'property' | Where-Object -FilterScript {$_ -Ne 'InstalledGraceKey' -And $_ -Ne 'MigrationToV5Done' -And $_ -Ne 'test' -And $_ -Ne 'unknown'}
+ $vNextPrids = Get-Item -Path $vNextRegkey -ErrorAction Ignore | Select-Object -ExpandProperty 'property' | Where-Object -FilterScript {$_.ToLower() -like "*retail" -or $_.ToLower() -like "*volume"}
If ($vNextPrids -Eq $null)
{
Write-Host "No registry keys found."
@@ -457,15 +456,20 @@ function PrintLicensesInformation
$license = (Get-Content -Encoding Unicode $_.FullName | ConvertFrom-Json).License
$decodedLicense = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($license)) | ConvertFrom-Json
$licenseType = $decodedLicense.LicenseType
- $userId = $decodedLicense.Metadata.UserId
- $identitiesRegkey = Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Identity\Identities\${userId}*" -ErrorAction Ignore
+ If ($null -Ne $decodedLicense.ExpiresOn)
+ {
+ $expiry = [DateTime]::Parse($decodedLicense.ExpiresOn, $null, 48)
+ }
+ Else
+ {
+ $expiry = New-Object DateTime
+ }
$licenseState = $null
If ((Get-Date) -Gt (Get-Date $decodedLicense.MetaData.NotAfter))
{
$licenseState = "RFM"
}
- ElseIf (($decodedLicense.ExpiresOn -Eq $null) -Or
- ((Get-Date) -Lt (Get-Date $decodedLicense.ExpiresOn)))
+ ElseIf ((Get-Date) -Lt (Get-Date $expiry))
{
$licenseState = "Licensed"
}
@@ -483,11 +487,11 @@ function PrintLicensesInformation
Acid = $decodedLicense.Acid;
LicenseState = $licenseState;
EntitlementStatus = $decodedLicense.Status;
+ EntitlementExpiration = $decodedLicense.ExpiresOn;
ReasonCode = $decodedLicense.ReasonCode;
NotBefore = $decodedLicense.Metadata.NotBefore;
NotAfter = $decodedLicense.Metadata.NotAfter;
NextRenewal = $decodedLicense.Metadata.RenewAfter;
- Expiration = $decodedLicense.ExpiresOn;
TenantId = $decodedLicense.Metadata.TenantId;
} | ConvertTo-Json
}
@@ -502,11 +506,11 @@ function PrintLicensesInformation
DeviceId = $decodedLicense.Metadata.DeviceId;
LicenseState = $licenseState;
EntitlementStatus = $decodedLicense.Status;
+ EntitlementExpiration = $decodedLicense.ExpiresOn;
ReasonCode = $decodedLicense.ReasonCode;
NotBefore = $decodedLicense.Metadata.NotBefore;
NotAfter = $decodedLicense.Metadata.NotAfter;
NextRenewal = $decodedLicense.Metadata.RenewAfter;
- Expiration = $decodedLicense.ExpiresOn;
TenantId = $decodedLicense.Metadata.TenantId;
} | ConvertTo-Json
}