Rearm Wizard - The Premier Rearm Solution for Windows 7 and Office 2013

Discussion in 'MDL Projects and Applications' started by timesurfer, Mar 27, 2013.

  1. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #381 timesurfer, Apr 25, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Noticed a little difference in check IR6.bat than D420 IR6.bat

    Code:
    Check IR6
    
    SET file=%sd%\IR6.bat
    echo @echo off>%file%
    echo for /f "tokens=2 delims==" %%%%A IN ('"bcdedit|find "osdevice""') do set dl=%%%%A>>%file%
    echo reg load HKLM\MY_SYSTEM "%%dl%%\Windows\System32\config\system"^>NUL >>%file%
    echo reg delete HKLM\MY_SYSTEM\WPA /f^>NUL >>%file%
    echo reg unload HKLM\MY_SYSTEM^>NUL>>%file%
    echo echo del "%sd%\IR6.bat" ^>%%dl%%\installkey.bat >>%file%
    echo echo del "%systemdrive%\key.vbs" ^>^>%%dl%%\installkey.bat >>%file%
    echo echo cscript /b slmgr.vbs /ipk %PIDKEY%^>^>%%dl%%\installkey.bat >>%file%
    echo echo slmgr.vbs /dlv^>^>%%dl%%\installkey.bat>>%file%
    echo echo del "%systemdrive%\installkey.bat"^>^>%%dl%%\installkey.bat>>%file%
    echo echo CreateObject("WScript.Shell").Run """%systemdrive%\installkey.bat""", 0, False^>%%dl%%\key.vbs >>%file%
    echo reg load HKLM\MY_SOFTWARE "%%dl%%\Windows\System32\config\software" ^>NUL >>%file% 
    echo reg add HKLM\MY_SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v InstallKey /t REG_SZ /d %systemdrive%\key.vbs ^>NUL >>%file%
    echo reg unload HKLM\MY_SOFTWARE >>%file%
    echo wpeutil reboot >>%file%
    Code:
    D420 IR6
    
    SET file=%sd%\IR6.bat
    echo @echo off>>%file% 
    echo echo Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2") ^>^>drive.vbs>>%file% 
    echo echo Set colItems = objWMIService.ExecQuery( "SELECT * FROM Win32_Volume",,48) ^>^>drive.vbs>>%file% 
    echo echo For Each objItem in colItems ^>^>drive.vbs>>%file% 
    echo echo If Hex(%sn%) = Hex(objItem.SerialNumber) then ^>^>drive.vbs>>%file% 
    echo echo Wscript.Echo objItem.DriveLetter ^>^>drive.vbs>>%file% 
    echo echo End If ^>^>drive.vbs>>%file% 
    echo echo Next ^>^>drive.vbs>>%file% 
    echo for /f %%%%A IN ('"cscript /nologo drive.vbs"') do set dl=%%%%A>>%file% 
    echo set dl=%%dl:~0,-1%%>>%file%
    echo del drive.vbs>>%file% 
    echo reg load HKLM\MY_SYSTEM "%%dl%%\Windows\System32\config\system" ^>NUL >>%file% 
    echo reg delete HKLM\MY_SYSTEM\WPA /f ^>NUL >>%file% 
    echo reg unload HKLM\MY_SYSTEM ^>NUL >>%file%
    echo echo cscript /b slmgr.vbs /ipk %PIDKEY% ^>%%dl%%\installkey.bat >>%file%
    echo echo slmgr.vbs /dlv ^>^>%%dl%%\installkey.bat >>%file%
    echo echo del "C:\installkey.bat" ^>^>%%dl%%\installkey.bat >>%file%
    echo echo CreateObject("WScript.Shell").Run """C:\installkey.bat""", 0, False ^>%%dl%%\key.vbs >>%file%
    echo echo @echo off ^>%%dl%%\launch.bat >>%file%
    echo echo wscript.exe "C:\key.vbs" ^>^>%%dl%%\launch.bat >>%file%
    echo echo del "%sd%\IR6.bat" ^>^>%%dl%%\launch.bat >>%file%
    echo echo del "C:\key.vbs" ^>^>%%dl%%\launch.bat >>%file%
    echo echo del "C:\launch.bat" ^>^>%%dl%%\launch.bat >>%file%
    echo reg load HKLM\MY_SOFTWARE "%%dl%%\Windows\System32\config\software" ^>NUL >>%file% 
    echo  reg add HKLM\MY_SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce  /v  InstallKey /t REG_SZ /d C:\launch.bat ^>NUL >>%file%
    echo reg unload HKLM\MY_SOFTWARE >>%file%
    echo wpeutil reboot >>%file%
     
  2. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #382 timesurfer, Apr 25, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
    This part of check.bat is not needed
    Code:
    schtasks /query | FINDSTR /i "IR6" >nul
    if %errorlevel%==0 (
    schtasks /create /tn "IR6" /tr "'%systemdrive%\Windows\system32\cmd.exe' /c cscript.exe /b %SystemDrive%\Windows\System32\slmgr.vbs /rearm && net stop sppsvc && net start sppsvc" /sc daily /mo 30 /ru "" /f >NUL
    )
    Because task always get's recreated to reset 30 days at rearm moment

    What is this part doing?

    Code:
    %windir%\resources\Themes\IR6Bkup.theme
     
  3. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    #383 s1ave77, Apr 25, 2013
    Last edited by a moderator: Apr 20, 2017
    For the difference in install IR6 code, the part in Check.bat is from old MasterDisaster script and is shorter, but does the same :D.

    Code:
    %windir%\resources\Themes\IR6Bkup.theme
    starts the backed up theme in restore part :D.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #385 timesurfer, Apr 25, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Check.bat IR6 uninstall needs to look like this

    Code:
    :UninstallIR6
    CLS
    REG  ADD "HKLM\SOFTWARE\Microsoft\Windows   NT\CurrentVersion\SoftwareProtectionPlatform\Activation" /v   NotificationDisabled /t REG_DWORD /d 0 /f >NUL
    SET file=%SystemDrive%\IR6 2>&1
    IF EXIST %file% attrib -h %file% 2>&1
    IF EXIST %file% RD /S /Q  %file% 2>&1
    schtasks /delete /tn "IR6" /f >NUL 2>&1
    schtasks /delete /tn "Hybrid2" /f >NUL 2>&1
    IF %ERRORLEVEL%==0 ( echo IR6 has been successfully uninstalled...
    ) ELSE (
    echo IR6 is already uninstalled...
    )
    ping -n 5 127.0.0.1 >nul
    GOTO :Exit
    Code:
    ::rearm task
    :Rearm
    echo:
    for /f "usebackq tokens=2 delims==" %%n in (`"%SystemRoot%\System32\wbem\WMIC.exe" /namespace:\\root\cimv2 path SoftwareLicensingService get RemainingWindowsReArmCount /format:list`) do set r=%%n
    if %r% == 0 goto :Messagebox
    cscript.exe /b %windir%\system32\slmgr.vbs /rearm
    net stop sppsvc >NUL
    net start sppsvc >NUL
    schtasks /query | FINDSTR /i "IR6" >nul
    if %errorlevel%==0 (
    schtasks /create /tn "IR6" /tr "'%systemdrive%\Windows\system32\cmd.exe' /c cscript.exe /b %SystemDrive%\Windows\System32\slmgr.vbs /rearm && net stop sppsvc && net start sppsvc" /sc daily /mo 30 /ru "" /f >NUL
    )
    xcopy "%systemdrive%\IR6\TranscodedWallpaper.jpg" /s /q "%wppath%" /Y >nul
    xcopy "%systemdrive%\IR6\IR6Bkup.theme" /s /q "%windir%\resources\Themes" /Y >nul
    reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes" /t REG_SZ /v CurrentTheme /d "%windir%\resources\Themes\IR6Bkup.theme" /f >NUL
    %windir%\resources\Themes\IR6Bkup.theme
    goto :Exit
    It runs without a cmd of any sort?
     
  5. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    Red part simply restores the backed up theme (after copying back) when rearming.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    Just when I was catching up :suicide:
     
  7. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,455
    989
    60
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    #389 s1ave77, Apr 25, 2013
    Last edited by a moderator: Apr 20, 2017
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    #390 s1ave77, Apr 25, 2013
    Last edited by a moderator: Apr 20, 2017
    Code:
    :UninstallIR6
    CLS
    REG  ADD "HKLM\SOFTWARE\Microsoft\Windows    NT\CurrentVersion\SoftwareProtectionPlatform\Activation" /v    NotificationDisabled /t REG_DWORD /d 0 /f >NUL
    SET file=%SystemDrive%\IR6 2>&1
    IF EXIST %file% attrib -h %file% 2>&1
    IF EXIST %file% RD /S /Q  %file% 2>&1
    schtasks /delete /tn "IR6" /f >NUL 2>&1
    schtasks /delete /tn "Hybrid2" /f >NUL 2>&1
    IF %ERRORLEVEL%==0 ( echo IR6 has been successfully uninstalled...
    ) ELSE (
    echo IR6 is already uninstalled...
    )
    ping -n 5 127.0.0.1 >nul
    GOTO :Exit
    There have sneaked too much spaces into your code, which shouldn´t be there. Look at:
    Code:
    Windows    NT
    and
    Code:
    /v    NotificationDisabled
    it has to be only one, but in yours there are three.


    I found them on several more places in :InstallIR6-part and corrected them in my version.

    So here is Duality420: :busted_blue: View attachment 21703 :busted_blue:


    • only corrected the spacing in :InstallIR6 in your code
    • added the writing of Check.bat to :InstallIR6
    • NOTE: the rest of the code is untouched (took it from last working version)
    • Test 1:
      • installed IR6 from Duality420
        • Check.bat is properly created
        • system boots to Win PE
        • in PE c:ir6 prompts success and reboots
        • system starts and after short moment watermark disappears
        • the /dlv-Window appears and states 5 rearms left :D
    • Test 2:
      • rearmed the system 5 times in a row (created a BAT to do the job :D)
      • forwarded time for a month to get system again in Notification
      • started Check.bat
        • Messagebox pops up and i choosed "Reinstall"
        • system boots to Win PE
        • in PE c:ir6 prompts success and reboots
        • system starts and after short moment watermark disappears
        • the /dlv-Window appears and states 5 rearms left :D
    • Reverted to last snapshot and repeated same procedure 2 times
    • GOTCHA! :cool2:


    What is next.........?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,455
    989
    60
    Nice. Once I am back on my machine I will test. (My cpu fan went out and the manufacture is mailing me another <3.)
    Downloading now to see code.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #392 timesurfer, Apr 25, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
    It's RE not PE, PE is disk :p

    This is wonderful work S77, I can't believe how wonderful it is you and Humphrey donated your MD level skills to my project and I really appreciate it with all my heart, plus now I got the neatest W7 rearm solution ever

    :worthy: S77

    So awesome work everyone

    Since it appears all my ideas manifested we have a new build to share with the world

    Thank you S77 and Humphrey and all others who put their efforts and brilliant coding to The Rearm Concept for Win7

    :D

    Well if speed is an issue, I guess we could WMIC all the status for IR6/IORRT and add your direct launching of function for choice section

    So no more cscript.exe %windir%\system32\slmgr.vbs /dlv | FINDSTR /I "Remaining" or

    cscript OSPP.VBS /dstatus | FINDSTR /i "Remaining"

    For IORRT I guess you could check for rearm with WMIC instead of me doing backup and rearming and if can't rearm we assume there are no rearms left and IORRT doesn't install. That is the way I designed it but to just check would be faster cause the Check backup folder wouldn't have to be created/deleted when checking if rearms present. IORRT only needs 1 rearm to work infinitely

    Will slowly go through the archives to find all co-developers/testers, etc for first page. I'll start to reorganize first page with new pics and content if necessary
     
  12. qewlpal

    qewlpal MDL Addicted

    Jun 25, 2010
    575
    2,014
    30
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #395 timesurfer, Apr 25, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
  14. qewlpal

    qewlpal MDL Addicted

    Jun 25, 2010
    575
    2,014
    30
    #396 qewlpal, Apr 25, 2013
    Last edited by a moderator: Apr 20, 2017
    Code:
    echo  * If you get error messages like "'C:IR6' is not a valid internal or external command" or "The Device is not ready" try D:IR6, E:IR6, F:IR6, G:IR6, H:IR6 or I:IR6 at step 3
    
    This is what i meant..
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #397 timesurfer, Apr 25, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Ok I'll think about being more specific

    Thanks
     
  16. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    #399 s1ave77, Apr 25, 2013
    Last edited by a moderator: Apr 20, 2017
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270