Solution for Legit Win10 losing activation (Possible)

Discussion in 'Windows 10' started by digitalbear, Aug 29, 2017.

  1. digitalbear

    digitalbear MDL Member

    Oct 23, 2012
    117
    14
    10
    I regularly do a restore from disk image created by Win10 with (Backup and Restore - Windows7) by booting with Win10 recovery usb. And sometimes this installation loses its activation, complaining about incorrect profile/cannot contact activation servers, etc.

    Well I have created a crude script that I ran for 4 hours and it eventually got the installation activated again :)

    :loop
    cscript /nologo slmgr.vbs /ato
    echo Trying...
    timeout 5
    goto loop

    You need to save this as .cmd file and run it as Admin.
    it will try to automatically activate windows every 5 seconds.

    I know this script can be made much better, but it worked for me so hopefully it will help someone else out there as well.
     
  2. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    12,459
    13,537
    340
    What does it actually use to activate? HWID activation normally is instantly or takes a few minutes and a reboot to activate, why should you run any script?
    KMS activation is always instant.
     
  3. digitalbear

    digitalbear MDL Member

    Oct 23, 2012
    117
    14
    10
    The problem is that for some Win10 users clicking on activate windows complains about incorrect profile/cannot contact activation servers and lot of users reported clicking the activate button hundreds of times it eventually activated.

    So the script above is an infinite loop doing the manual clicking above every 5 seconds.

    I rather have a script doing this then to click hundreds of times. It helped me activate windows after running for about 4 hours.
     
  4. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,477
    627
    60
    In your case Windows would have activated on it's own whenever the activation server became available.
    Anyway, I've added an exit for your batch with a msgbox:
    Code:
    @echo off
    if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start "" /min "%~dpnx0" %* && exit
    :loop
    for /f "tokens=3 delims=: " %%a in (
        'cscript //nologo "%systemroot%\system32\slmgr.vbs" /dli ^| find "License Status:"'
    ) do set "licenseStatus=%%a"
    
    if /i "%licenseStatus%"=="Licensed" (
        echo msgbox "Windows 10 has been Activated" > %tmp%\tmp.vbs
        cscript /nologo %tmp%\tmp.vbs
        del %tmp%\tmp.vbs
    ) else (
       cscript /nologo slmgr.vbs /ato
       echo Trying...
       timeout 5
       goto loop
    )
    
     
  5. digitalbear

    digitalbear MDL Member

    Oct 23, 2012
    117
    14
    10
    Thank you Filpp3r,

    Great help from an Expert Batch Programmer :)