diff options
| author | WindowsAddict | 2025-04-15 01:32:19 +0000 |
|---|---|---|
| committer | WindowsAddict | 2025-04-15 01:32:19 +0000 |
| commit | 0d61475468de80b7f711038384e754331a14c7d8 (patch) | |
| tree | 63c5fc1f11b0267f9bf78e5ce3442d3584025b70 /MAS/Separate-Files-Version/Activators | |
| parent | c316b42e5cd166aa5c10a54d03ca0c5e5d63f4cd (diff) | |
| download | Microsoft-Activation-Scripts-0d61475468de80b7f711038384e754331a14c7d8.zip | |
Fix an issue where Office doesn't need activation but TSforge would show phone license missing error
Diffstat (limited to 'MAS/Separate-Files-Version/Activators')
| -rw-r--r-- | MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 4a9af9c..3330a77 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -6747,6 +6747,24 @@ function Get-WmiInfo { }
}
+function slGetSkuInfo($SkuId) {
+ $t = [AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0)
+ $t.DefinePInvokeMethod('SLOpen', 'slc.dll', 22, 1, [Int32], @([IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128)
+ $t.DefinePInvokeMethod('SLClose', 'slc.dll', 22, 1, [IntPtr], @([IntPtr]), 1, 3).SetImplementationFlags(128)
+ $t.DefinePInvokeMethod('SLGetProductSkuInformation', 'slc.dll', 22, 1, [Int32], @([IntPtr], [Guid].MakeByRefType(), [String], [UInt32].MakeByRefType(), [UInt32].MakeByRefType(), [IntPtr].MakeByRefType()), 1, 3).SetImplementationFlags(128)
+ $w = $t.CreateType()
+ $hSLC = 0
+ try {
+ [void]$w::SLOpen([ref]$hSLC)
+ $c = 0; $b = 0
+ $r = $w::SLGetProductSkuInformation($hSLC, [ref][Guid]$SkuId, "msft:sl/EUL/PHONE/PUBLIC", [ref]$null, [ref]$c, [ref]$b)
+ return ($r -eq 0)
+ }
+ finally {
+ [void]$w::SLClose($hSLC)
+ }
+}
+
if ($env:resetstuff -eq $null) {
foreach ($tsactid in $tsactids) {
try {
@@ -6757,6 +6775,13 @@ if ($env:resetstuff -eq $null) { $prodName = if ($nameParts.Count -gt 1) { ($nameParts[1].Trim() -split '[ ,]')[0] } else { $null }
}
[LibTSforge.Modifiers.GenPKeyInstall]::InstallGenPKey($ver, $prod, $tsactid)
+ if ($prodName -match 'Office' -and -not (slGetSkuInfo($tsactid))) {
+ $licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus"
+ if ($licenseStatus -eq 1) {
+ Write-Host "[$prodName] is already permanently activated." -ForegroundColor White -BackgroundColor DarkGreen
+ continue
+ }
+ }
[LibTSforge.Activators.ZeroCID]::Activate($ver, $prod, $tsactid)
$licenseStatus = Get-WmiInfo -tsactid $tsactid -property "LicenseStatus"
if ($licenseStatus -eq 1) {
|
