From b352fc7247190a6c6303b7999f23289f0181633d Mon Sep 17 00:00:00 2001 From: John Gaunt Date: Mon, 25 Nov 2024 19:17:43 -0500 Subject: [PATCH] Updated regex and $null logic --- kms.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kms.ps1 b/kms.ps1 index ce58abb..9e97967 100644 --- a/kms.ps1 +++ b/kms.ps1 @@ -56,10 +56,10 @@ $osType = Get-WmiObject -Class Win32_OperatingSystem $osInfo = Get-ComputerInfo if ($osType.ProductType -eq 1) { - if ($osInfo.WindowsProductName -match "Windows 10 Enterprise LTSC 20[19|21|24]") { + if ($osInfo.WindowsProductName -match "Windows 10 Enterprise LTSC 20(19|21|24)") { # Windows 10/11 2019/2021/2024 LTSC c:\Windows\System32\cscript.exe /nologo c:\Windows\System32\slmgr.vbs /ipk M7XTQ-FN8P6-TTKYV-9D4CC-J462D - }elseif ($osInfo.WindowsProductName -match "Windows 10 IoT Enterprise LTSC 20[19|21|24]") { + }elseif ($osInfo.WindowsProductName -match "Windows 10 IoT Enterprise LTSC 20(19|21|24)") { # Windows 10/11 IoT 2019/2021/2024 LTSC c:\Windows\System32\cscript.exe /nologo c:\Windows\System32\slmgr.vbs /ipk KBN8V-HFGQ4-MGXVD-347P6-PDQGT } elseif ($osInfo.WindowsProductName -eq "Windows 10 Enterprise LTSB 2016") { @@ -102,7 +102,7 @@ if (test-path "C:\Program Files\Microsoft Office\Office16\ospp.vbs") { } elseif (test-path "C:\Program Files (x86)\Microsoft Office\Office16\ospp.vbs") { $officePath = "C:\Program Files (x86)\Microsoft Office\Office16\ospp.vbs" } -if ($officePath -ne $null) { +if ($null -ne $officePath) { # Office 2024 LTSC c:\Windows\System32\cscript.exe /nologo "$officePath" /inpkey:XJ2XN-FW8RK-P4HMP-DKDBV-GCVGB # Project Pro 2024 LTSC