Unable to run windows activation powershell script through task sequence

noob sccm 1 Reputation point
2022-07-25T17:33:59.547+00:00

Hi,

We are using SCCM/MECM 2103 in our organization. I am trying to run a powershell script through task sequence to activate windows 10 using product key. The scripts I used are as follows :

1.

=================================================================================

$productkey=(Get-CimInstance -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey

slmgr -ipk $productkey

===========================================================================

2.

===========================================================================

$Productkey =(Get-WmiObject -Class SoftwareLicensingService).OA3xOriginalProductkey
cscript /b C:\Windows\System32\slmgr.vbs -ipk $Productkey
cscript /b C:\Windows\System32\slmgr.vbs -ato

===========================================================================

I put this step after 'Setup Windows and Configuration Manager' but this scripts is not activating the windows. However If I use this script locally on the machine it worked. Please note we do

not use KMS server or MAK to activate windows. We use E5 license which is not activating the windows either and is totally a separate issue.

Now, please help me to troubleshoot how can I activate windows through sccm task sequence? What I am missing here?

Thanks in Advance

Windows for business Windows Server User experience PowerShell
Microsoft Security Intune Configuration Manager Deployment
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Amandayou-MSFT 11,156 Reputation points
    2022-07-26T08:59:51.493+00:00

    Hi,

    In the task sequence, we could input the product key directly in it instead of the script.

    Here is the related article we could refer to:
    https://learn.microsoft.com/en-us/mem/configmgr/osd/understand/task-sequence-steps#product-key

    As we mentioned, use this script locally on the machine it worked, which account we used? is it current user account or system account? Please use the system account, and check if it is successful.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


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.