97 lines
3.3 KiB
PowerShell
97 lines
3.3 KiB
PowerShell
#MAK & ESU discovery v2
|
|
|
|
$Esu1Bool = $false
|
|
$Esu2Bool = $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 = 'MF2F8-YGGFX-6MKDF-PCM29-7BYDG'
|
|
$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'
|
|
}
|
|
'Microsoft Windows Server 2008 R2 Enterprise ' {
|
|
write-verbose "switch enterprise edition"
|
|
$MakId = '6a4bd364-4b60-4856-a727-efb59d94348e'
|
|
$MakKey = '3YY4J-742QP-GPKP9-G2R6W-K6DDM'
|
|
$Esu1Id = '553673ed-6ddf-419c-a153-b760283472fd'
|
|
$Esu1Key = 'MMFTT-7FBRY-W9QYW-37FMB-TRPJK'
|
|
$Esu2Id = '04fa0286-fa74-401e-bbe9-fbfbb158010d'
|
|
$Esu2Key = '6P3TQ-J2C3Y-VK2TD-8P648-Y3TF6'
|
|
}
|
|
'Microsoft Windows Server 2008 R2 Standard ' {
|
|
write-verbose "switch standard edition"
|
|
$MakId = ''
|
|
$MakKey = '3YY4J-742QP-GPKP9-G2R6W-K6DDM'
|
|
$Esu1Id = '553673ed-6ddf-419c-a153-b760283472fd'
|
|
$Esu1Key = 'MMFTT-7FBRY-W9QYW-37FMB-TRPJK'
|
|
$Esu2Id = '04fa0286-fa74-401e-bbe9-fbfbb158010d'
|
|
$Esu2Key = '6P3TQ-J2C3Y-VK2TD-8P648-Y3TF6'
|
|
}
|
|
'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'
|
|
}
|
|
'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'
|
|
}
|
|
'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'
|
|
}
|
|
}
|
|
|
|
$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
|
|
}
|
|
}
|
|
|
|
$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 $Makbool -eq $true) {
|
|
$compliant = $true
|
|
}
|
|
else {
|
|
$compliant = $false
|
|
}
|
|
|
|
$compliant |