[UNSUPPORTED] Open 7 act*vator by Nononsence [revised by HotCarl] ;-)

Discussion in 'Windows 7' started by HotCarl, Oct 29, 2009.

  1. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    @HotCarl

    i sent one back and i hope it works :p
     
  2. HotCarl

    HotCarl MDL Addicted

    Jul 21, 2009
    830
    17
    30

    Thanks for the insight. I think I will do as you say and stick with the if statement rather than set it if there is an exception call when trying to invoke slmgr.vbs with the .Start() method... :)
     
  3. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    its all good really i just stated how i would do it and i really hope it helped you in anyway.

    im still learning vb.net thats why my code is somewhat random but it always seems to work out
     
  4. HotCarl

    HotCarl MDL Addicted

    Jul 21, 2009
    830
    17
    30

    They will both work if implemented correctly, and both will decide in real-time whether or not to use slmgr to install the product key & certificate... I like it because the user has to click or select nothing, the tool does it all for them. If there is no slmgr present then it will not be used. :)
     
  5. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    in my tool i did it to give the user more options really

    i didnt want to force something that didnt need to be forced :p
     
  6. HotCarl

    HotCarl MDL Addicted

    Jul 21, 2009
    830
    17
    30

    That is why the IF statement...it is only done without slmgr if is NEEDS to. :D
     
  7. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    thats true but what if the user would like to install the key with the way he/she knows how to do it :p

    anyways wmi might fail if sppsvc is off
     
  8. HotCarl

    HotCarl MDL Addicted

    Jul 21, 2009
    830
    17
    30

    Well, if user has no slmgr and sppsvc is off then I guess they may be out of luck... :p


    I would recommend a Win7 reinstall at that point, then use the l0ader :)
     
  9. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    if RemoveWAT was used it could cause that.
     
  10. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    :p that wont start sppsvc but this will after a restart

    sc config sppsvc start= demand
     
  11. Alphawaves

    Alphawaves Admin / Developer
    Staff Member

    Aug 11, 2008
    6,255
    22,410
    210
  12. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    i dont have tampered files lol maybe other ppl do
     
  13. nononsence

    nononsence MDL Addicted

    Aug 18, 2009
    806
    826
    30
    #155 nononsence, Nov 14, 2009
    Last edited by a moderator: Apr 20, 2017
    slmgr.vbs uses wmi to do its job, at one point I copied and pasted the functions in to new scripts to see how they work

    slmgr -ipk
    Code:
    Key = ""
    
    
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
        On Error Resume Next  
        Set colServices = objWMIService.ExecQuery("SELECT Version FROM SoftwareLicensingService")
        QuitIfError()
        For each objService in colServices
            QuitIfError()
            Exit For
        Next
    
    objService.InstallProductKey(Key)
    objService.RefreshLicenseStatus()
    
    Wscript.Quit
    
    slmgr -ilc
    Code:
    cert = "cert.xrm-ms"
    
    LicenceData = ReadAllTextFile(cert)
    
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    
    
        Dim objService
        Dim colServices
    
        On Error Resume Next
           
        Set colServices = objWMIService.ExecQuery("SELECT Version FROM SoftwareLicensingService")
        QuitIfError()
    
        For each objService in colServices
            QuitIfError()
            Exit For
        Next
    
        set GetServiceObject = objService    
    
    
    objService.InstallLicense(LicenceData)
    objService.RefreshLicenseStatus()
    
    Wscript.Quit
    
    
    '==================================================
    'function ReadAllTextFile
    '==================================================
    
    Function ReadAllTextFile(strFileName)
        Dim strData
        Dim oStream
        
        Set oStream = CreateObject("ADODB.Stream")
    
        oStream.Type = 2 'adTypeText
        oStream.Open
        oStream.Charset = GetFileEncoding(strFileName)
        oStream.LoadFromFile(strFileName)
    
        strData = oStream.ReadText(-1) 'adReadAll
    
        oStream.Close
    
        ReadAllTextFile = strData
    End Function
    
    
    '==================================================
    'function GetFileEncoding
    '==================================================
    
    Function GetFileEncoding(strFileName)
        Dim strData
        Dim strEncoding
        Dim oStream
    
        Set oStream = CreateObject("ADODB.Stream")
    
        oStream.Type = 1 'adTypeBinary
        oStream.Open
        oStream.LoadFromFile(strFileName)
    
        ' Default encoding is ascii
        strEncoding =  "ascii"
    
        strData = BinaryToString(oStream.Read(2))
    
        ' Check for little endian (x86) unicode preamble
        If (Len(strData) = 2) and strData = (Chr(255) + Chr(254)) Then
            strEncoding = "unicode"
        Else
            oStream.Position = 0
            strData = BinaryToString(oStream.Read(3))
    
            ' Check for utf-8 preamble
            If (Len(strData) >= 3) and strData = (Chr(239) + Chr(187) + Chr(191)) Then
                strEncoding = "utf-8"
            End If
        End If
    
        oStream.Close
    
        GetFileEncoding = strEncoding
    End Function
    
    
    '==================================================
    'Function BinaryToString
    '==================================================
    
    Function BinaryToString(dataBinary)
      Dim i
      Dim str
    
      For i = 1 To LenB(dataBinary)
        str = str & Chr(AscB(MidB(dataBinary, i, 1)))
      Next
    
      BinaryToString = str
    End Function
    
    
    ' Returns string containing the whole text file data.
    ' Supports ascii, unicode (little-endian) and utf-8 encoding.
    Function ReadAllTextFile(strFileName)
        Dim strData
        Dim oStream
        
        Set oStream = CreateObject("ADODB.Stream")
    
        oStream.Type = 2 'adTypeText
        oStream.Open
        oStream.Charset = GetFileEncoding(strFileName)
        oStream.LoadFromFile(strFileName)
    
        strData = oStream.ReadText(-1) 'adReadAll
    
        oStream.Close
    
        ReadAllTextFile = strData
    End Function
    
     
  14. HotCarl

    HotCarl MDL Addicted

    Jul 21, 2009
    830
    17
    30

    I just posted O7A v1.1.1, then I saw your comment...

    I am trying to decide if I should implement code to check if slmgr is missing and sppsvc is not running, then attempt to start sppsvc via cmd.exe...

    But then what if cmd.exe is missing too...man, it is a never-ending ordeal :p

    I think I will leave it as I have it for now, and if there are many issues with people not having slmgr nor sppsvc running, then I will add additional code...lol.
     
  15. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    lol i forgot you use cmd /c

    i just use the sc commands and leave cmd out of it
     
  16. HotCarl

    HotCarl MDL Addicted

    Jul 21, 2009
    830
    17
    30

    I think it will be fine for now...I mean, if the user uses O7A 1.1.1 and cannot act!vate, then they have serious problems with their Windows 7... Like slmgr.vbs and cmd.exe must be gone and sppsvc must be stopped all together to stop O7A from installing (I think anyway if I have implemented everything correctly)...

    I think if O7A fails then the user may want to consider reinstalling Windows 7, because they have some serious issues. :p
     
  17. PAYMYRENT

    PAYMYRENT MDL Developer

    Jul 28, 2009
    1,460
    421
    60
    thats so true lol
     
  18. HotCarl

    HotCarl MDL Addicted

    Jul 21, 2009
    830
    17
    30
    #160 HotCarl, Nov 14, 2009
    Last edited: Nov 14, 2009
    (OP)
    Well, I hope people let me know if they have any issues...and if so, try to hit print screen and get a picture of the problem if there is one. Thanks for everyone's help/input/suggestions. :)

    I cant fall asleep again now so I think I am gonna bust out some modern warfare 2...! I actually killed my xbox 360 DVD drive last night playing it for like 8 hours straight (the drive had been making noises for a while and it finally died last night (disk read errors), so I had to stay up for another 45 minutes to an hour or so removing the old DVD drive (it was a bitch to cr@ck the case open), then flashing the old firmware onto the new drive, then installing the new drive...so I am good to go again today. :D)