Little script to Get Windows 10/11 Product Key using PowerShell ?

Sometimes, your recovery option in windows doesnt work and you need to format your laptop but you dont know how to activate your windows again (I know that product Key is saved in BIOS in new PCs, but I’m tolking about PCs that didnt have this option).

here is a little script to get your windows product Key.

# Get the original product key from SoftwareLicensingService
$productKey = (Get-WmiObject -Query 'select * from SoftwareLicensingService').OA3xOriginalProductKey
Write-Host "Product Key : $productKey" -ForegroundColor Green

Here is the result :

Thanks

Aymen EL JAZIRI (Microsoft MVP)
Aymen EL JAZIRI (Microsoft MVP)

Hi, I’m Aymen El Jaziri , a passionate System Administrator and Microsoft MVP, with years of hands-on experience in managing and securing modern IT infrastructures.
This blog is where I share technical guides, automation scripts, product reviews, and real-world solutions that help IT professionals simplify their day-to-day work and stay ahead in a fast-evolving cloud ecosystem.
Whether you’re here to troubleshoot an issue, improve your automation game, or learn new best practices , welcome in my blog !
Let’s build a stronger, smarter IT community together.
Feel free to connect with me on LinkedIn for more content, discussions, or collaboration opportunities.

Thanks

Aymen

Articles: 154