Jump to content











Photo

OEM Product Activation - Clearing the Crapware!


  • Please log in to reply
35 replies to this topic

#26 Blackcrack

Blackcrack

    Frequent Member

  • Advanced user
  • 458 posts
  •  
    Germany

Posted 21 December 2014 - 11:50 AM

Wonko, can i shooting the duck, please, i have hungry.. plllleeeaasseeeee .....

*bridegrin* *looking around the corner to Nuno* *giggle*



#27 Ed007

Ed007
  • Members
  • 1 posts
  •  
    United Kingdom

Posted 30 January 2015 - 01:20 PM

 

Once Windows has been installed, use the following batch file (run as admin) to (re)activate using the Extracted OEM Certificate and SLP product key taken from your working OEM system (edit the path to your oemcert.xrm-ms file and change the product key) -

 

Ok I've done the rest and made the oemcrt file, but i have some questions just so i can be sure that what I'm about to do is correct:

 

1) Do i enter the activation code that i found using the keyfider tools into the oemcert file?

2) How do i edit the path to the oemcert file?

3) As for the BATCH file, (.BAT) can i name it anything, like command.bat, i ask because when using bat files in games like skyrim, you can name them anything you want as long as it is followed by .bat, but i just want to be crystal clear when it comes to this, just in case.

 

I have both a legitimate OEM disc form when i built my PC, and a copy of the exact same operating system from digital river. Win7 HP 64bit.

 

BTW, the system I'm going to try this on, is an Acer Aspire 5551 laptop, i do have the recover discs but just the thought of sitting for over an hour cleaning it all out and getting back to just the basic Windows 7 OS with no bloat, then to spend yet another hour or so tweaking the OS and gutting out all the Windows7 bundled stuff i don't like and never use... it's just a bit too annoy for me, but i do need my laptop so this is why i want to try this out.

 

I have already tried simply wiping the pre-installed Win7 HP64bit and then using the activation key i found using the keyfinding software to activate both the OEM disc i have, and the copy i got from digital river, but while they both pass windows activation tool tests, it still says on the System page that i have x-amount of days to activate windows. I called microsoft and the confirmed there was nothing wrong with the key and passed me onto Acer, who then passed me onto PCworld where i got the laptop, very annoying, but at least i know this will be the last stage in the process.

 

If this fails to work, then at the very least i have those recover discs and I'll just have to deal with the hassle and hours of cleaning it out and tweaking it all over again.



#28 cdob

cdob

    Gold Member

  • Expert
  • 1469 posts

Posted 02 February 2015 - 09:45 PM

1) Do i enter the activation code that i found using the keyfider tools into the oemcert file?
2) How do i edit the path to the oemcert file?
3) As for the BATCH file, (.BAT) can i name it anything


1) No, don't add the key to cert file.

2)
SET CERT=OEM.XRM-MS
SET CERT=c:\cert\OEM.XRM-MS
 
3) Any name within sane restrictions. What about cert.cmd?

#29 d4vr0s

d4vr0s

    Member

  • Advanced user
  • 38 posts
  • Location:The greatest computer in the universe of time and space, designed by Deep Thought
  •  
    United States

Posted 15 February 2015 - 02:38 PM

This is excellent information Misty!

The next level is getting the activation information from a non-bootable system

There have been times where I've wanted to re-install windows from scratch but the original OEM key sticker was either missing or otherwise illegible.

This will work in WinPE if you have WinPE-Scripting.cab installed, but you have to use the path to the offline windows as a parameter. I think adding ExplorerFrame.dll will fix the folder requester but I haven't had time to test it yet. I used the same file names as the tool marsilies posted, so -In Theory- you should be able to use it's restore application. (In fact I used it's RegEx to find the certificate)

If all works as expected you should have:

backup-key.txt = Windows product Key

backup-cert.xrm-ms = Certificate extracted from Tokens.dat

An empty file with the Product Name = so you know which version needs to be re-installed.

 

I have only tested extracting the information from Windows 7 (And Product Key from Windows 8.1).

I tested this with a new Lenovo Thinkcentre.

Commandline: cscript getofflineactivation.vbs drive:\path_to_windows

 

Feedback is welcome.

 

So here it is (Bear in mind that I'm not a programmer and have just taken snippets of code from different sources to achieve my purpose):

GetOffLineActivation.vbs

' 2015-02-15
On Error Resume Next

Dim WshShell
Set WshShell=CreateObject("WScript.Shell")
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set lPath=LCase(wshShell.ExpandEnvironmentStrings("%SystemRoot%"))

If WScript.Arguments.Count = 0 then
  GetOffline=WshShell.Popup("Get Activation from Offline Windows?",,"Online or Offline",vbYesNoCancel + vbQuestion + vbSystemModal)
  Select Case GetOffline
    Case vbYes
      GetLocal=0
    Case vbNo
      GetLocal=1
      Hive="Software"
      oPath=lPath
    Case vbCancel
      WScript.quit
  End Select
  If GetLocal = 0 Then
    oPath = LCase(SelectFolder())
      If Len(oPath) < 2 Then
        WScript.Echo "Cancelled"
        wscript.quit
      End If
  End If
Else
    oPath=LCase(WScript.Arguments(0))
End If

' Check for online windows
If oPath = lPath Then
  GetLocal=1
  Hive="Software"
' Check for WinPE
ElseIf oPath=LCase("X:\Windows") Then
  wscript.echo "WinPE Detected as Target, quitting"
  wscript.quit
End IF

' w7
If objFso.FileExists(oPath & "\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat") Then
  'W7
  Set GetToken = objFSO.GetFile(oPath & "\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat")
  GetCert
ElseIf objFso.FileExists(oPath & "\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareLicensing\tokens.dat") Then
  'Vi
  Set GetToken = objFSO.GetFile(oPath & "\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareLicensing\tokens.dat")
  GetCert
Else
  wscript.echo "Tokens.dat not found, Certificate cannot be extracted"
End If

Set KeyFile=objFSO.CreateTextFile("backup-key.txt", True) 'Output File
GetDigID

wscript.echo "Done"
wscript.quit

Function GetCert()
  Set objRegEx = CreateObject("VBScript.RegExp")
  objRegEx.Pattern = "<\?xml version=""1\.0"" encoding=""utf-8"".*?OEM Certificate.*?</r:license>"
  objRegEx.Global = False
  objRegEx.ignoreCase = False
  Set TokenFile = GetToken.OpenAsTextStream(1)
  Set CertFile = objFSO.CreateTextFile("backup-cert.xrm-ms", True) 'Output File
  strSearchString = TokenFile.Read(GetToken.Size)
  Set CertMatch = objRegEx.Execute(strSearchString)
  If CertMatch.Count = 0 Then        
    wscript.echo "No Matches"
    CertFile.close
  else
    CertFile.Write CertMatch(0).value
    CertFile.close
  End If
  TokenFile.Close
End Function

Function GetDigId()
  If GetLocal=0 Then 
    Hive="OfflineHive"
    OpenReg=WshShell.Run("reg.exe load HKLM\OfflineHive " & oPath & "\System32\Config\Software",0,True)
  End If
  DigID=WshShell.RegRead("HKLM\" & Hive & "\Microsoft\Windows NT\CurrentVersion\DigitalProductId")
  WinVer=WshShell.RegRead("HKLM\" & Hive & "\Microsoft\Windows NT\CurrentVersion\CurrentVersion")
  ObjFSO.CreateTextFile(WshShell.RegRead("HKLM\" & Hive & "\Microsoft\Windows NT\CurrentVersion\ProductName"))
  If GetLocal=0 Then    
    CloseReg=WshShell.Run("reg.exe unload HKLM\OfflineHive",0,True)
  End If
  If WinVer > 6.1 Then
    ConVertToKey DigID ' Win 8+
  Else
    ExtractKey DigID ' Win 7
  End If
End Function 

' Windows 7, Vi, XP
Function ExtractKey(KeyInput)
    Const KeyOffset = 52
    i = 28
    CharWhitelist = "BCDFGHJKMPQRTVWXY2346789"
    Do
        Cur = 0
        x = 14
        Do
            Cur = Cur * 256
            Cur = KeyInput(x + KeyOffset) + Cur
            KeyInput(x + KeyOffset) = (Cur \ 24) And 255
            Cur = Cur Mod 24
            x = x -1
        Loop While x >= 0
        i = i -1
        KeyOutput = Mid(CharWhitelist, Cur + 1, 1) & KeyOutput
        If (((29 - i) Mod 6) = 0) And (i <> -1) Then
            i = i -1
            KeyOutput = "-" & KeyOutput
        End If
    Loop While i >= 0
    KeyFile.Write KeyOutput
    KeyFile.Close
End Function

' Windows 8+
Function ConvertToKey(Key)
    Const KeyOffset = 52
    Dim isWin8, Maps, i, j, Current, KeyOutput, Last, keypart1, insert
    'Check if OS is Windows 8
    isWin8 = (Key(66) \ 6) And 1
    Key(66) = (Key(66) And &HF7) Or ((isWin8 And 2) * 4)
    i = 24
    Maps = "BCDFGHJKMPQRTVWXY2346789"
    Do
       	Current= 0
        j = 14
        Do
           Current = Current* 256
           Current = Key(j + KeyOffset) + Current
           Key(j + KeyOffset) = (Current \ 24)
           Current=Current Mod 24
            j = j -1
        Loop While j >= 0
        i = i -1
        KeyOutput = Mid(Maps,Current+ 1, 1) & KeyOutput
        Last = Current
    Loop While i >= 0 
    keypart1 = Mid(KeyOutput, 2, Last)
    insert = "N"
    KeyOutput = Replace(KeyOutput, keypart1, keypart1 & insert, 2, 1, 0)
    If Last = 0 Then KeyOutput = insert & KeyOutput
    WinKey = Mid(KeyOutput, 1, 5) & "-" & Mid(KeyOutput, 6, 5) & "-" & Mid(KeyOutput, 11, 5) & "-" & Mid(KeyOutput, 16, 5) & "-" & Mid(KeyOutput, 21, 5)
    KeyFile.Write WinKey
    KeyFile.Close
End Function

Function SelectFolder()
    Dim objFolder, objShell
    Set objShell=CreateObject("Shell.Application")
    Set objFolder=objShell.BrowseForFolder(0, "Select Folder", 0, ssfDRIVES)
    If IsObject(objfolder) Then SelectFolder=objFolder.Self.Path
End Function

If Err.Number <> 0 Then
    'error handling:
    MsgBox Err.Number & " Srce: " & Err.Source & " Desc: " &  Err.Description
    Err.Clear
End If

Edit: Some code cleanup


  • dog likes this

#30 d4vr0s

d4vr0s

    Member

  • Advanced user
  • 38 posts
  • Location:The greatest computer in the universe of time and space, designed by Deep Thought
  •  
    United States

Posted 16 February 2015 - 09:53 PM

Here is a script for restoring the activation.

It requires the backup files to be in the same directory as the script and the file names must be the same as the ones created by GetOfflineActivation.vbs

 

Be extremely careful, it removes all keys from the installation and adds the one from the backup.

Do not run this on an activated windows.

 

It also can be used to enter a key from the OEM sticker if the backup files are not found.

The script will not continue unless those files exist or a 25 (or 29 with dashes) character key is entered.

 

ReActivateFromBackup.vbs

' 2015-03-05
Dim WshShell, ChkKey
Set WshShell=CreateObject( "WScript.Shell" )
InstallKey=WshShell.Popup("Remove and Install Key?",,"Attention! Dangerous!",vbYesNo+vbCritical+vbSystemModal)

Select Case InstallKey
  Case vbYes
    MsgBox ("Wait for 'Done' Dialog!")
    ReActivate
  Case vbNo
    WScript.Quit
End Select

Function ReActivate()
  Dim Key, KeyFile, objFSO
  Set objFSO=CreateObject("Scripting.FileSystemObject")
  CurrDir=objFSO.GetParentFolderName(wscript.ScriptFullName)  
  If Not objFSO.FileExists(CurrDir & "\backup-key.txt") Or Not objFso.FileExists(CurrDir & "\backup-cert.xrm-ms") Then
    UseKey=WshShell.Popup("Backup files not found, use key method?",,"Attention! Dangerous!",vbYesNo+vbCritical+vbSystemModal)
    Select Case UseKey
      Case vbYes
        Do Until (Len(Key) = 25)
          Key=InputBox("This will continue to re-open until a 25 character (with dashes) key is entered or exit if nothing is entered.","Enter Key")
          TestKey(Key)
          If Len(Key) = 0 Then
            wscript.quit
          ElseIf ChkKey.Count <> Len(Key) Then
             wscript.echo "Invalid Character Detected, Try again"
             Key=0
          End If
        Loop
      Case vbNo
        WScript.Quit
    End Select
    NoBackup=1
  End If
  WshShell.Run "slmgr.vbs -upk", 1, True
  If Not NoBackup=1 Then
    set KeyFile=objFSO.OpenTextFile(CurrDir & "\backup-key.txt",1)
    Key=KeyFile.ReadLine
    KeyFile.Close
    WshShell.Run "slmgr.vbs -ilc " & CurrDir & "\backup-cert.xrm-ms", 1, True
  End If
  WshShell.Run "slmgr.vbs -ipk " & Key, 1, True
  WshShell.Run "slmgr.vbs -ato", 1, True
  MsgBox ("Done")
End Function

Function TestKey(Key)
  Set objRegEx = CreateObject("VBScript.RegExp")
  objRegEx.Pattern = "[BCDFGHJKMNPQRTVWXY2346789-]"
  objRegEx.Global = True
  objRegEx.ignoreCase = True
  Set ChkKey = objRegEx.Execute(Key)
End Function

Edit: Additional checking for invalid characters when manually entering key

Edit2: Apparently the dashes in the key are required by slmgr


Edited by d4vr0s, 05 March 2015 - 12:42 PM.


#31 Blackcrack

Blackcrack

    Frequent Member

  • Advanced user
  • 458 posts
  •  
    Germany

Posted 17 February 2015 - 06:22 AM

can you also make this as exexute file with backup the  regestration,

because, if we can activation it (so me as user) whant i before make

an backup of my regestration . Because if i be netless *s* on an offline computer,

whant it be well if i have an also well running WinNT on an offline-station..

I.. think also on Facility's where be prevention to be offline,

because the connectivity enables a lot of the net... you know ..

and why this, an possibility for backup the key and offline activation..

So, why not offline activation also in one program..

 

3 buttons, one "backup" "exit" "reactivation"

there over it an selecting-text-window where

listing the backuped Key's in the Folder for reactivation.

Registration Name (and other information) and Number

 

this want be an very nice tool for Administrators :)

 

best regards

Blacky



#32 d4vr0s

d4vr0s

    Member

  • Advanced user
  • 38 posts
  • Location:The greatest computer in the universe of time and space, designed by Deep Thought
  •  
    United States

Posted 17 February 2015 - 03:26 PM

I do not understand what you're asking.



#33 dog

dog

    Frequent Member

  • Expert
  • 236 posts

Posted 19 February 2015 - 04:53 PM

@Blackcrack

This topic is about backing up and restoring win7 OEM pre-activation, which does work offline, as it depends on strings in the BIOS.

If you need to back up a non-OEM activation that was done online or via the phone, you could try this:

http://www.msfn.org/...110#entry955110



#34 Blackcrack

Blackcrack

    Frequent Member

  • Advanced user
  • 458 posts
  •  
    Germany

Posted 20 February 2015 - 08:11 AM

Hi Dog and d4vr0s :)

 

backup and restore the regestration als "self" running exefile this vbs-scripts, for off line reactivation  :) 

for using easy as end-user, you know , vbs-scripts be well, but an exefile be more well ;)

 

and Dog, well, indeed, this have i mean therewith, an offline reactivation for new installs on the same mashin,

but maybe create you are an exe-file from it ? :)

 

best regards

Blacky



#35 Uneitohr

Uneitohr

    Frequent Member

  • Advanced user
  • 219 posts

Posted 16 March 2016 - 12:29 PM

The backup script always says "No Matches" . 

I have a notebook with an OEM COA Licence. Is it normal to find nothing?

 

Tried on Windows 7 and Windows 8 (two different laptops, COA License)


Edited by Alexander Ceed, 16 March 2016 - 12:46 PM.


#36 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 16 March 2016 - 03:25 PM

The backup script always says "No Matches" . 
I have a notebook with an OEM COA Licence. Is it normal to find nothing?
 
Tried on Windows 7 and Windows 8 (two different laptops, COA License)

Well, COA means Certificate Of Authenticity, all OEM licenses have a COA, but they may (or may not)  be SLP or SLIC activated.
As explained in the first post of this topic, first thing you should make sure that the SLP mechanism is actually used on your system:
 

To obtain the OEM certificate extract it using a hex editor (see below). These steps must be completed before installing your clean version of Windows.

I recommend that you take a backup of your system before attempting this tutorial. I'd hate for you to go through these steps to find that your system doesn't actually use SLP activation - having already wiped your working (activated) OEM installation. There are loads of system backup methods including paid and freeware - e.g. Ghost, DriveimageXML, Drive Snapshot. See Jamal's Image your System and Forget about Formatting – Period! for one method of backing up the system.



Checking the BIOS for SLIC information

AIDA64 can be used to check if your BIOS contains SLIC information - download from here. The limited functionality trial version can be used. Start AIDA64 and check Motherboard > ACPI > SLIC to see if a SLIC description table is present in your BIOS. This will display the SLP version used on your system (e.g. 2.0/2.1).

NOTE - The presence of a SLIC description table does not necessarily mean that your computer uses SLP activation - hence my suggestion to back up your system.



Remember to find your license key

As previously stated, the Product Key on the Certificate of Authenticity (COA) attached to an OEM system is not necessarily the key used to activate the computer if SLP activation is used. To find the SLP Product Key, use a keyfinder (e.g. Magical Jellybean, System Information Windows, etc).

 
The message you are getting comes probably from this function:
 
 
 
Function GetCert()
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Pattern = "<\?xml version=""1\.0"" encoding=""utf-8"".*?OEM Certificate.*?</r:license>"
objRegEx.Global = False
objRegEx.ignoreCase = False
Set TokenFile = GetToken.OpenAsTextStream(1)
Set CertFile = objFSO.CreateTextFile("backup-cert.xrm-ms", True) 'Output File
strSearchString = TokenFile.Read(GetToken.Size)
Set CertMatch = objRegEx.Execute(strSearchString)
If CertMatch.Count = 0 Then
wscript.echo "No Matches"
CertFile.close
else
CertFile.Write CertMatch(0).value
CertFile.close
End If
TokenFile.Close
End Function
Which should mean that the searched certificate is not found in any "tokens.dat".
 
:duff:
Wonko




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users