Get-WmiObject : There a lot a third party software out there you can buy to retrieve your microsoft window key. But for myself, I don’t like to install software on my machine because sometime the script will install a spyware on my machine.
Get-WmiObject: is the easiest way to Querying WMI on Local and Remote
(Get-WmiObject -ComputerName $computernameselect -query “select * from SoftwareLicensingService”).OA3xOriginalProductKey