get-wmiObject -query 'select * from SoftwareLicensingService'
get-wmiObject -query 'select * from SoftwareLicensingService'
New computers come often with a Windows 10 licence but after reinstall or replacing the disk you don't have the product key.
With the script you can get the key and in unattended modes you can put the kms or VLK in the script to activate windows. when you don't want the comments or extra product key option comment them out with a #
Write-Host 'Key not found., use a different license' $service.InstallProductKey('Put your License KEY here')
Write-Host 'Key not found., use a different license' $service.InstallProductKey('Put your License KEY here')