question

VikasJagtapBSL-2142 avatar image
0 Votes"
VikasJagtapBSL-2142 asked VikasJagtapBSL-2142 commented

Powershell script to install and activate ESU for WIndows server 2008

Hello
Need powershell script to install ESU product key and activation ID for windows server 2008. Currently we following below manual process

1) cscript slmgr.vbs /dlv - To check the ESU status
2) slmgr.vbs /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx - Installtion of product key
3) cscript slmgr.vbs /ato - For activating activation ID.

windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

IanXue-MSFT avatar image
0 Votes"
IanXue-MSFT answered IanXue-MSFT edited

Hi,

You can try something like below

 Get-Content -Path C:\ESUScript\computers.txt | ForEach-Object{
     cscript slmgr.vbs $_ /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx 
     cscript slmgr.vbs $_ /ato 
 }

Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

IanXue-MSFT avatar image
0 Votes"
IanXue-MSFT answered VikasJagtapBSL-2142 commented

Hi,

You can simply add these lines to your PowerShell script file.

 cscript slmgr.vbs /dlv 
 slmgr.vbs /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx 
 cscript slmgr.vbs /ato

Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
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.

· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello
Much appreciated for your help. Script running well but have some confusion over here. Its giving product activated and also giving error product key invalid. Can we get any result in separate csv file

97343-image.png


0 Votes 0 ·
image.png (24.4 KiB)

The Import-Csv cmdlet works with the CSV files. Please refer to this link for more details.
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/import-csv

For the activation issue, as it's not related to PowerShell, you can start another thread on it.

0 Votes 0 ·

Hello
I am using below command sequence in powershell, where currently we using .txt file to include bunch of server into it. Can you pls correct me if i am wrong

97369-image.png


0 Votes 0 ·
image.png (68.6 KiB)

Hello
Actually the problem is when we run above commands manually using cmd it run very well but as same as suggested when i put it in powershell its giving product key error msg

0 Votes 0 ·
Show more comments