fixed admin section. fixed logic as gt was wrong. removed extra comments. added pause to end to read status
This commit is contained in:
14
kms.ps1
14
kms.ps1
@@ -10,7 +10,7 @@ $myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWin
|
|||||||
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
|
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
|
||||||
|
|
||||||
# Check to see if we are currently running "as Administrator" and not 64 bit
|
# Check to see if we are currently running "as Administrator" and not 64 bit
|
||||||
if ($myWindowsPrincipal.IsInRole($adminRole) -and -not [environment]::Is64BitProcess) {
|
if ($myWindowsPrincipal.IsInRole($adminRole)) {
|
||||||
# We are running "as Administrator" - so change the title and background color to indicate this
|
# We are running "as Administrator" - so change the title and background color to indicate this
|
||||||
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)"
|
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)"
|
||||||
#$Host.UI.RawUI.BackgroundColor = "DarkBlue"
|
#$Host.UI.RawUI.BackgroundColor = "DarkBlue"
|
||||||
@@ -55,7 +55,7 @@ c:\Windows\System32\cscript.exe /nologo c:\Windows\System32\slmgr.vbs /skms gaun
|
|||||||
$osType = Get-WmiObject -Class Win32_OperatingSystem
|
$osType = Get-WmiObject -Class Win32_OperatingSystem
|
||||||
$osInfo = Get-ComputerInfo
|
$osInfo = Get-ComputerInfo
|
||||||
|
|
||||||
if ($osType.ProductType -gt 1) {
|
if ($osType.ProductType -eq 1) {
|
||||||
if ($osInfo.WindowsProductName -eq "Windows 10 Enterprise LTSC 2019") {
|
if ($osInfo.WindowsProductName -eq "Windows 10 Enterprise LTSC 2019") {
|
||||||
# Windows 10 2019 LTSC
|
# Windows 10 2019 LTSC
|
||||||
c:\Windows\System32\cscript.exe /nologo c:\Windows\System32\slmgr.vbs /ipk M7XTQ-FN8P6-TTKYV-9D4CC-J462D
|
c:\Windows\System32\cscript.exe /nologo c:\Windows\System32\slmgr.vbs /ipk M7XTQ-FN8P6-TTKYV-9D4CC-J462D
|
||||||
@@ -65,14 +65,10 @@ if ($osType.ProductType -gt 1) {
|
|||||||
} elseif ($osInfo.WindowsProductName -match "Windows 1[0-1] Enterprise") {
|
} elseif ($osInfo.WindowsProductName -match "Windows 1[0-1] Enterprise") {
|
||||||
# Windows 10/11 Enterprise
|
# Windows 10/11 Enterprise
|
||||||
c:\Windows\System32\cscript.exe /nologo c:\Windows\System32\slmgr.vbs /ipk NPPR9-FWDCX-D2C8J-H872K-2YT43
|
c:\Windows\System32\cscript.exe /nologo c:\Windows\System32\slmgr.vbs /ipk NPPR9-FWDCX-D2C8J-H872K-2YT43
|
||||||
} else<#if ($osInfo.WindowsProductName -match "Windows 1[0-1] Professional") #>{
|
} else {
|
||||||
# Windows 10/11 Pro
|
# Windows 10/11 Pro
|
||||||
c:\Windows\System32\cscript.exe /nologo c:\Windows\System32\slmgr.vbs /ipk W269N-WFGWX-YVC9B-4J6C9-T83GX
|
c:\Windows\System32\cscript.exe /nologo c:\Windows\System32\slmgr.vbs /ipk W269N-WFGWX-YVC9B-4J6C9-T83GX
|
||||||
} <#else {
|
}
|
||||||
$message = "Your desktop version is not supported or could not be detected corrected. Version: $($osInfo.WindowsProductName)"
|
|
||||||
write-error $message
|
|
||||||
exit
|
|
||||||
}#>
|
|
||||||
} else {
|
} else {
|
||||||
if ($osInfo.WindowsProductName -eq "Windows Server 2022 DataCenter") {
|
if ($osInfo.WindowsProductName -eq "Windows Server 2022 DataCenter") {
|
||||||
# windows Server 2022 Datacenter
|
# windows Server 2022 Datacenter
|
||||||
@@ -108,7 +104,7 @@ if ($officePath -ne $null) {
|
|||||||
# Activate it
|
# Activate it
|
||||||
c:\Windows\System32\cscript.exe /nologo "$officePath" /act
|
c:\Windows\System32\cscript.exe /nologo "$officePath" /act
|
||||||
}
|
}
|
||||||
|
pause
|
||||||
# Office 2013: YC7DK-G2NP3-2QQC3-J6H88-GVGXT
|
# Office 2013: YC7DK-G2NP3-2QQC3-J6H88-GVGXT
|
||||||
# Office 2016:
|
# Office 2016:
|
||||||
# Office 2019: NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP
|
# Office 2019: NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP
|
||||||
|
|||||||
Reference in New Issue
Block a user