Files
Sandbox/SCCM-ESUDiscoveryY3.ps1
T
Zack Meier 03dba08135 sync
2026-04-15 15:42:41 -05:00

121 lines
4.2 KiB
PowerShell

#MAK & ESU discovery v3.1
$Esu1Bool = $false
$Esu2Bool = $false
$Esu3Bool = $false
$MakBool = $false
$OS = (Get-WMIObject Win32_OperatingSystem).Caption
Write-Verbose $OS
switch ($OS) {
'Microsoft Windows Server 2008 R2 Datacenter ' {
write-verbose "switch datacenter edition"
$MakId = '4ae528f4-05c3-446e-90ea-a4fbd460b83a'
$MakKey = '33YCD-89CD2-RMYVW-RGX7W-R9XRM'
$Esu1Id = '553673ed-6ddf-419c-a153-b760283472fd' #activationid
$Esu1Key = 'MMFTT-7FBRY-W9QYW-37FMB-TRPJK'
$Esu2Id = '04fa0286-fa74-401e-bbe9-fbfbb158010d'
$Esu2Key = '6P3TQ-J2C3Y-VK2TD-8P648-Y3TF6'
$Esu3Id = '16c08c85-0c8b-4009-9b2b-f1f7319e45f9'
$Esu3Key = '36FB4-RK77J-C867T-QPJBT-4PMW6'
}
'Microsoft Windows Server 2008 R2 Enterprise ' {
write-verbose "switch enterprise edition"
$MakId = '6a4bd364-4b60-4856-a727-efb59d94348e'
$MakKey = 'TB9WQ-WKHVH-W7946-WJTVV-Y6QDD'
$Esu1Id = '553673ed-6ddf-419c-a153-b760283472fd'
$Esu1Key = 'MMFTT-7FBRY-W9QYW-37FMB-TRPJK'
$Esu2Id = '04fa0286-fa74-401e-bbe9-fbfbb158010d'
$Esu2Key = '6P3TQ-J2C3Y-VK2TD-8P648-Y3TF6'
$Esu3Id = '16c08c85-0c8b-4009-9b2b-f1f7319e45f9'
$Esu3Key = '36FB4-RK77J-C867T-QPJBT-4PMW6'
}
'Microsoft Windows Server 2008 R2 Standard ' {
write-verbose "switch standard edition"
$MakId = ''
$MakKey = 'TB9WQ-WKHVH-W7946-WJTVV-Y6QDD'
$Esu1Id = '553673ed-6ddf-419c-a153-b760283472fd'
$Esu1Key = 'MMFTT-7FBRY-W9QYW-37FMB-TRPJK'
$Esu2Id = '04fa0286-fa74-401e-bbe9-fbfbb158010d'
$Esu2Key = '6P3TQ-J2C3Y-VK2TD-8P648-Y3TF6'
$Esu3Id = '16c08c85-0c8b-4009-9b2b-f1f7319e45f9'
$Esu3Key = '36FB4-RK77J-C867T-QPJBT-4PMW6'
}
'Microsoft Windows 7 Enterprise ' {
write-verbose "switch Win7 enterprise edition"
$MakId = '9abf5984-9c16-46f2-ad1e-7fe15931a8dd'
$MakKey = 'PRV3H-98HJK-6KKBF-RHYTM-JWCRV'
$Esu1Id = '77db037b-95c3-48d7-a3ab-a9c6d41093e0'
$Esu1Key = 'MJCJ8-24DFX-VGK6H-XYBQ7-F6PR8'
$Esu2Id = '0e00c25d-8795-4fb7-9572-3803d91b6880'
$Esu2Key = 'WX34W-WG8MH-TWWCV-PXK96-RDMTJ'
$Esu3Id = '4220f546-f522-46df-8202-4d07afd26454'
$Esu3Key = 'TF336-89RVD-X2FJJ-YV3KF-Q6KPF'
}
'Microsoft® Windows Server® 2008 Standard ' {
write-verbose "switch 08 Standard"
$MakId = 'ad2542d4-9154-4c6d-8a44-30f11ee96989'
$MakKey = 'GQK9D-CT4WQ-9KJ87-FKMT8-MR73Q'
$Esu1Id = '553673ed-6ddf-419c-a153-b760283472fd'
$Esu1Key = 'MMFTT-7FBRY-W9QYW-37FMB-TRPJK'
$Esu2Id = '04fa0286-fa74-401e-bbe9-fbfbb158010d'
$Esu2Key = '6P3TQ-J2C3Y-VK2TD-8P648-Y3TF6'
$Esu3Id = '16c08c85-0c8b-4009-9b2b-f1f7319e45f9'
$Esu3Key = '36FB4-RK77J-C867T-QPJBT-4PMW6'
}
'Microsoft® Windows Server® 2008 Enterprise ' {
write-verbose "switch 08 Enterprise"
$MakId = 'bb1d27c4-959d-4f82-b0fd-c02a7be54732'
$MakKey = 'GQK9D-CT4WQ-9KJ87-FKMT8-MR73Q'
$Esu1Id = '553673ed-6ddf-419c-a153-b760283472fd'
$Esu1Key = 'MMFTT-7FBRY-W9QYW-37FMB-TRPJK'
$Esu2Id = '04fa0286-fa74-401e-bbe9-fbfbb158010d'
$Esu2Key = '6P3TQ-J2C3Y-VK2TD-8P648-Y3TF6'
$Esu3Id = '16c08c85-0c8b-4009-9b2b-f1f7319e45f9'
$Esu3Key = '36FB4-RK77J-C867T-QPJBT-4PMW6'
}
}
$software = Get-WMIObject -Class SoftwareLicensingProduct
$EsuYear1 = $software | Where-Object { $_.Id -eq $Esu1Id }
If ($EsuYear1) {
If ($EsuYear1.LicenseStatus -eq '1') {
$Esu1Bool = $true
}
}
$EsuYear2 = $software | Where-Object { $_.Id -eq $Esu2Id }
If ($EsuYear2) {
If ($EsuYear2.LicenseStatus -eq '1') {
$Esu2Bool = $true
}
}
$EsuYear3 = $software | Where-Object { $_.Id -eq $Esu3Id }
If ($EsuYear3) {
If ($EsuYear3.LicenseStatus -eq '1') {
$Esu3Bool = $true
}
}
$Mak = $software | where-object { $_.Id -eq $MakId }
If ($Mak) {
If ($Mak.LicenseStatus -eq 1) {
$MakBool = $true
}
}
If ($Esu1bool -eq $true -and $Esu2Bool -eq $true -and $Esu3Bool -eq $true -and $Makbool -eq $true) {
$compliant = $true
}
else {
$compliant = $false
}
$compliant
#2008 std/ent TB9WQ-WKHVH-W7946-WJTVV-Y6QDD
#2008 dcntr 33YCD-89CD2-RMYVW-RGX7W-R9XRM