To do this we are going to utilize a small PowerShell script to remotely run a command to clear the assigned KMS host on multiple clients.
Doing this will remove the manual KMS Host entry and re-enable auto-discovery.
Normally if your clients are pointing to a dead KMS host – you will notice that you can’t activate them again in VAMT (Volume Activation Management Tool), you will receive either error : Operation Timed Out or Unable to connect to the remote server.
What the script does –
It takes a list of host names from a CSV, then runs the clear KMS cache command (slmgr.vbs /ckms) on each server listed, this will force the KMS client to auto-discover a new KMS Host on the subnet. You can change the script to manually set a different specific KMS host by using the – slmgr.vbs /skms <value>:<port> instead of slmgr.vbs /ckms.
Script / CSV Example / Script Results –
$Servers = Get-Content C:\Temp\Book1.csv #Gets Hostnames from CSV $Servers = $Servers[1..($Servers.count - 1)] #Removes Header $UserCredential = Get-Credential #prompt for creddentials #Removes the currently set KMS host on each KMS Client in the CSV and sets it to auto discovery ForEach ($server in $Servers) { Invoke-Command -ComputerName $server -ScriptBlock {Invoke-Expression "cscript c:\windows\system32\slmgr.vbs /ckms"} -credential $UserCredential }
Hope this is helpful – feel free to change the slmgr.vbs command in the script if you want to utilize a different command on multiple servers/workstations.
Thanks for reading – feel free to follow and stay updated 🙂 View sysadminguides’s profile on Facebook View GuidesSysadmin’s profile on Twitter View 115372466162675927272’s profile on Google+