Jump to content
Sign in to follow this  
Helomotorola

I complete Set Windows Key Programme. But If I set by a Invaild Key then happen a ERROR

Recommended Posts

Helomotorola

$VOL_PROD_KEY = "MRX3F-47B9T-2487J-KWKMF-RPWBY"
$VOL_PROD_KEY = StringReplace($VOL_PROD_KEY,"-","")
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}")
$colItems = $objWMIService.InstancesOf ("win32_WindowsProductActivation")
For $Obj in $colItems
    $result = $Obj.SetProductKey ($VOL_PROD_KEY)
Next
Msgbox(0 + 64, "You change key " & $VOL_PROD_KEY & " is Successful")

I Change value $VOL_PROD_KEY by a new key. If Invail key then arise Error,

I want prevent that ERROR by a message as

Msgbox(0 + 48, "You change key " & $VOL_PROD_KEY & " is Invaild")

Thank much

Edited by Helomotorola

Share this post


Link to post
Share on other sites
cdkid

Well my first thought is REMOVE YOUR WINDOWS KEY FROM YOUR POST

~cdkid


AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites
Siao

Well my first thought is REMOVE YOUR WINDOWS KEY FROM YOUR POST

~cdkid

It's one of those warez keys anyway. Do a google search for it :)

Edited by Siao

"be smart, drink your wine"

Share this post


Link to post
Share on other sites
ssubirias3

It's one of those warez keys anyway. Do a google search for it :)

Nice! Our girl Helomotorola is trying to convert a vbs to au3. This Micosoft Support article Q328874 explains what she's trying to do. The vbs she's trying to convert is this ChangeVLKey2600.vbs

' 
' WMI Script - ChangeVLKey.vbs
'
' This script changes the product key on the computer
'
'***************************************************************************

ON ERROR RESUME NEXT

if Wscript.arguments.count<1 then
   Wscript.echo "Script can't run without VolumeProductKey argument"
   Wscript.echo "Correct usage: Cscript ChangeVLKey.vbs ABCDE-FGHIJ-KLMNO-PRSTU-WYQZX"
   Wscript.quit
end if

Dim VOL_PROD_KEY
VOL_PROD_KEY = Wscript.arguments.Item(0)
VOL_PROD_KEY = Replace(VOL_PROD_KEY,"-","") 'remove hyphens if any
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegDelete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WPAEvents\OOBETimer" 'delete OOBETimer registry value
for each Obj in GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf ("win32_WindowsProductActivation")

   result = Obj.SetProductKey (VOL_PROD_KEY)

   if err <> 0 then
      WScript.Echo Err.Description, "0x" & Hex(Err.Number)
      Err.Clear
   end if

Next

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×