slmgr.vbs -ipk
slmgr.vbs -ato
$computer = gc env:computername
$key = "AAAAA-BBBBB-CCCCC-DDDDD-EEEEE"
$service = Get-WmiObject -Query "select * from SoftwareLicensingService" -ComputerName $computer
$service.InstallProductKey($key)
$service.RefreshLicenseStatus()