KATOCHIMOTO
11-02-2014, 17:17
Имеется вот такой скрипт (есть в интернете):
Get-WmiObject -class Win32_NTLogEvent -computerName $RemoteComputerName -filter "Logfile='Key Management Service' And EventCode=12290" | foreach-object {
$_ | Add-Member noteproperty "Return Code" $_.InsertionStrings[1]
$_ | Add-Member noteproperty "Minimum Count To Activate" $_.InsertionStrings[2]
$_ | Add-Member noteproperty Machine $_.InsertionStrings[3]
$_ | Add-Member noteproperty "Client Machine ID" $_.InsertionStrings[4]
$_ | Add-Member noteproperty "Client Time" $_.InsertionStrings[5]
$_ | Add-Member noteproperty "VM Info" $_.InsertionStrings[6]
$_ | Add-Member noteproperty "Licensing Status" $_.InsertionStrings[7]
$_ | Add-Member noteproperty "Time to Expiration, min" $_.InsertionStrings[8]
$_ | Add-Member noteproperty "Activation ID" $_.InsertionStrings[9]
write-output $_ | select-object RecordNumber, Machine, "Return Code", "Minimum Count To Activate", "Client Machine ID", "Client Time", "VM Info", "Licensing Status", "Time to Expiration, min", "Activation ID"
}
выводит инфу вот так
RecordNumber : 16002
Machine : C-DC1.contoso.com
Return Code : 0x0
Minimum Count To Activate : 5
Client Machine ID : *******-***-***-***-*******
Client Time : 2014/02/10 15:52
VM Info : 1
Licensing Status : 1
Time to Expiration, min : 249120
Activation ID : ******-****-*****-****-******
Значения он берет из журнала событий. Как сделать что бы выдаваемое значения в VM Info вместо 1, было- Virtual machine, а если 0 то Phisical Machine ? и License Status в зависимости от 0 до 4 выдало не цифру а Licensed status:
0 -Unlicensed
1 - Licensed
2 - Out-Of-Box Grace Period
3 - Out-Of-Tolerance Grace Period
4 -Non-Genuine Grace Period
Get-WmiObject -class Win32_NTLogEvent -computerName $RemoteComputerName -filter "Logfile='Key Management Service' And EventCode=12290" | foreach-object {
$_ | Add-Member noteproperty "Return Code" $_.InsertionStrings[1]
$_ | Add-Member noteproperty "Minimum Count To Activate" $_.InsertionStrings[2]
$_ | Add-Member noteproperty Machine $_.InsertionStrings[3]
$_ | Add-Member noteproperty "Client Machine ID" $_.InsertionStrings[4]
$_ | Add-Member noteproperty "Client Time" $_.InsertionStrings[5]
$_ | Add-Member noteproperty "VM Info" $_.InsertionStrings[6]
$_ | Add-Member noteproperty "Licensing Status" $_.InsertionStrings[7]
$_ | Add-Member noteproperty "Time to Expiration, min" $_.InsertionStrings[8]
$_ | Add-Member noteproperty "Activation ID" $_.InsertionStrings[9]
write-output $_ | select-object RecordNumber, Machine, "Return Code", "Minimum Count To Activate", "Client Machine ID", "Client Time", "VM Info", "Licensing Status", "Time to Expiration, min", "Activation ID"
}
выводит инфу вот так
RecordNumber : 16002
Machine : C-DC1.contoso.com
Return Code : 0x0
Minimum Count To Activate : 5
Client Machine ID : *******-***-***-***-*******
Client Time : 2014/02/10 15:52
VM Info : 1
Licensing Status : 1
Time to Expiration, min : 249120
Activation ID : ******-****-*****-****-******
Значения он берет из журнала событий. Как сделать что бы выдаваемое значения в VM Info вместо 1, было- Virtual machine, а если 0 то Phisical Machine ? и License Status в зависимости от 0 до 4 выдало не цифру а Licensed status:
0 -Unlicensed
1 - Licensed
2 - Out-Of-Box Grace Period
3 - Out-Of-Tolerance Grace Period
4 -Non-Genuine Grace Period