Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

PENDING Collection based on machines using KMS server

regbnn

New Member
Messages
2
Reaction score
0
Points
1
I need help creating a collection that pulls in machines that is using the KMS server to pull licenses.
 
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
 
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
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.
 

Forum statistics

Threads
7,168
Messages
27,979
Members
18,281
Latest member
kerber

Trending content

Back
Top