$events = Get-WinEvent -computername KMS01 -LogName "Key Management Service" -FilterXPath "*[System[(EventID=12288 or EventID=12289 or EventID=12290)]]" -MaxEvents 10
$Results = foreach ($SingleEvent in $events){
$xml = [xml]$SingleEvent.ToXml()
[PSCustomObject]@{
EventID = $SingleEvent.Id
ClientName = $xml.Event.EventData.Data[3]
TimeCreated = $SingleEvent.TimeCreated
Message = $SingleEvent.Message
}
}
$Results
I know the Kms server name that is getting used I just need to know how to create a collection that shows the machines pointing to that server. What I am trying to do is find the machines that is pointing to that server and determine if they should stay pulling their license from it or do I need to run a script that points it to the onboard license in the machine.This is little tricky. What you can try is using the event viewer to determine the KMS servers used by client and then create a collection.
Code:$events = Get-WinEvent -computername KMS01 -LogName "Key Management Service" -FilterXPath "*[System[(EventID=12288 or EventID=12289 or EventID=12290)]]" -MaxEvents 10 $Results = foreach ($SingleEvent in $events){ $xml = [xml]$SingleEvent.ToXml() [PSCustomObject]@{ EventID = $SingleEvent.Id ClientName = $xml.Event.EventData.Data[3] TimeCreated = $SingleEvent.TimeCreated Message = $SingleEvent.Message } } $Results