Get the installation serial number for the current Windows

Source: Internet
Author: User

Dim SS= InputBox ("the current Windows system serial number is:","Windows serial number", GETWINDOWSSN) Wscript.Quit'get the current Windows serial number functionFunction getwindowssn () Const HKEY_LOCAL_MACHINE= &H80000002 strKeyPath="SOFTWARE\Microsoft\Windows NT\CurrentVersion"strValueName="DigitalProductID"StrComputer="."Dim ivalues () Set oreg= GetObject ("winmgmts:{impersonationlevel=impersonate}!\\"& StrComputer &"\root\default:StdRegProv") Oreg.getbinaryvalue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, ivalues Dim arrdpid arrdpid=Array () for I= theTo theReDim Preserve arrdpid (UBound (arrdpid)+1) Arrdpid (UBound (arrdpid) )=ivalues (i) Next'<---------------Create An array to hold the valid characters for a Microsoft Product Key------------------------ -Dim arrchars arrchars= Array ("B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9")    '<---------------the clever bit!!! (Decrypt the BASE24 encoded binary data)-------------------------->For i = -To0Step-1k=0For J= -To0Step-1k= k * theXor Arrdpid (j) Arrdpid (j)= Int (k/ -) K= k Mod -Next Strproductkey= Arrchars (k) &Strproductkey'<-------Add the "-" between the groups of 5 Char-------->If I Mod5=0And I <>0Then Strproductkey ="-"&Strproductkey Next getwindowssn=strproductkeyend Function

Windows.vbs Universal

Get the installation serial number for the current Windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.