Hi @ all, sometimes you will need to change the CD-Key for a workstation. Even when you are getting new volume licenses - this is the way how you could do this on each station without doing it manually.
GeSHi (vbs):
'######################################
'How to change your CD-KEY #
'######################################
Dim WshShell
Dim oWPA
Dim res
Const sKey = "<insert_your_cd_key_here>"
Set WshShell = WScript.CreateObject("WScript.Shell")
'Use the command below to read the key as argument
'sKey = WScript.arguments.Item(0)
sKey = Replace(sKey, "-", "") 'remove the "-" from key
WshShell.RegDelete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WPAEvents\OOBETimer" 'delete OOBETimer
oWPA = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("win32_WindowsProductActivation")
On Error Resume Next
For Each Obj In oWPA
res = Obj.SetProductKey(sKey)
If Err <> 0 Then
WScript.Echo Err.Description, "0x" & Hex(Err.Number)
Err.Clear
End If
Next
Created by GeSHI 1.0.7.20