I've created a function that will change the Volume License Key on a local Computer. Any input on this function would be apreciated.

Code:

Function ChangeVLKey($VOL_PROD_KEY)
Dim $obj, $objects, $x
;Key is without hyphens (ABCDEFGHIJKLMNOPQRSTUVWXY)
$objects = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("win32_WindowsProductActivation")
If @Error <> 0
Exit @Error
EndIf
For Each $obj in $objects
$x = $obj.SetProductKey($VOL_PROD_KEY)
$ChangeVLKey = @error
Next
Exit @error
EndFunction



[edit]
Edited per Shawn's & NTDOC's suggestions.
[/edit]


Edited by apronk (2006-03-09 08:43 AM)