Updated regex and $null logic

This commit is contained in:
2024-11-25 19:17:43 -05:00
parent 0a18eadda8
commit b352fc7247

View File

@@ -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