Activate Many Computers using PowerShell


Just came in handy when you need to activate a bunch of computers (from a Windows Server 2012 R2)

I combined a PowerShell AD Computer search with a filter ("blablabla") and executed slmgr.vbs /ato remotely with no prompts:

 

$computers = Get-ADComputer -filter * | where name -like "blablabla*"

foreach ($computer in $computers)

{

Invoke-Command -ComputerName $computer.Name -ScriptBlock { Write-Output $env:COMPUTERNAME; Start-Process "C:\Windows\System32\cscript.exe" -argumentlist "//B ""C:\Windows\System32\slmgr.vbs"" /ato" -Wait}

}

 

 

Have fun.

Bernhard

 

Important note:

You need the Active Directory Module for Windows PowerShell installed on the System where you execute the Get-ADComputer:

image


Comments (0)

Skip to main content