How to update the product key in remote machines - Windows 10

Loganathan R 106 Reputation points
2022-01-11T06:30:22.903+00:00

Hello All,
We are planning to changing the 15-30 computers product key.
Can any one please advise how to proceed this activity by using the powershell or any tools?

Regards,
Loganathan. R

Windows for business | Windows Client for IT Pros | Networking | Network connectivity and file sharing
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 39,926 Reputation points
    2022-01-18T08:14:40.217+00:00

    Hello, Loganathan. R,

    one way is to use the slmgr.vbs script that comes on all Windows machines. Otherwise, WMI can accomplish this. Either approach should get the job done.

    In order to use PowerShell remoting every target computer must have PowerShell installed and PowerShell remoting enabled and accessible. So first you should confirm this by running a simple command on each computer.

    Invoke-Command -ComputerName SOMECOMPUTER -ScriptBlock {1}
    If this returns 1, then it's working.

    Once you have confirmed that PowerShell remoting is available on each computer, you will then need to figure out how to retrieve each computer name. if you have not done this already. If not, common ways include grabbing computer names from text files with Get-Content using the Path parameter when one computer exists on each line in a text file.

    $computers = Get-Content -Path C:\computers.txt

    Another common way to retrieve computer names is through the Get-ADComputer cmdlet available in the Active Directory module.

    $computers = Get-ADComputer -Filter * | Select-Object -ExpandProperty Name

    Regardless, you will simply need to build a collection of computer names somehow.

    $computers = 'PC1','PC2','PC3', etc
    After doing this, you will then need to figure out the syntax to invoke slmgr.vbs.

    slmgr -ipk <ProductKeyHere>

    Next, use Invoke-Command again and send this command to each computer all in one line.

    Invoke-Command -ComputerName $computers -ScriptBlock { slmgr -ipk <ProductKeyHere> }
    This will run on each computer and change the product key. If successful, a notification message for each computer will display.


    --If the reply is helpful, please Upvote and Accept as answer--

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.