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
    #641 timesurfer, Jun 25, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
    1. Starter just goes to rearm mode
    2. Home basic does rearm and background copy restore

    Here is the check.bat stuff for rearm and theme to insert version check and action thereof

    Code:
    md %SystemDrive%\IR6 >nul 2>&1
    echo @echo off >%SystemDrive%\IR6\Check.bat
    echo title IR6 Check Task >>%SystemDrive%\IR6\Check.bat
    echo mode con: cols=50 lines=12 >>%SystemDrive%\IR6\Check.bat
    echo echo Checking rearm and theme status... >>%SystemDrive%\IR6\Check.bat
    echo setlocal ENABLEDELAYEDEXPANSION >>%SystemDrive%\IR6\Check.bat
    echo mkdir "%%systemdrive%%\IR6" ^>nul 2^>^&1 >>%SystemDrive%\IR6\Check.bat
    echo SETX IR6backup "%%SystemDrive%%\IR6" ^>nul >>%SystemDrive%\IR6\Check.bat
    echo set KEY_NAME=HKCU\Software\Microsoft\Windows\CurrentVersion\Themes>>%SystemDrive%\IR6\Check.bat
    echo set VALUE_NAME=CurrentTheme>>%SystemDrive%\IR6\Check.bat
    echo set spp=SoftwareLicensingProduct>>%SystemDrive%\IR6\Check.bat
    echo for /F "usebackq tokens=3*" %%%%A IN (`reg query "%%KEY_NAME%%" /v "%%VALUE_NAME%%" 2^^^>nul ^^^| find "%%VALUE_NAME%%"`) do IF ~%%%%B==~ (SET themefile=%%%%A) ELSE (SET themefile=%%%%A %%%%B)>>%SystemDrive%\IR6\Check.bat
    echo for %%%%F in (%%themefile%%) do set theme=%%%%~nF>>%SystemDrive%\IR6\Check.bat
    echo wmic path %%spp%% get LicenseStatus /format:list 2^>nul ^| findstr /i 5 ^>nul 2^>^&1 >>%SystemDrive%\IR6\Check.bat
    echo if %%errorlevel%%==0 goto :Rearm >>%SystemDrive%\IR6\Check.bat
    echo if %%errorlevel%%==1 goto :Backup >>%SystemDrive%\IR6\Check.bat
    echo :Backup>>%SystemDrive%\IR6\Check.bat
    echo if exist "%%systemdrive%%\IR6\IR6Bkup.theme" del /s /q "%%systemdrive%%\IR6\IR6Bkup.theme" ^>nul>>%SystemDrive%\IR6\Check.bat
    echo echo F ^| xcopy "%%themefile%%" /s /q "%%systemdrive%%\IR6" /V /Y ^>nul >>%SystemDrive%\IR6\Check.bat
    echo ren "%%systemdrive%%\IR6\%%theme%%.theme" "IR6Bkup.theme">>%SystemDrive%\IR6\Check.bat
    echo goto :Exit >>%SystemDrive%\IR6\Check.bat
    echo :Rearm>>%SystemDrive%\IR6\Check.bat
    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 >>%SystemDrive%\IR6\Check.bat
    echo if %%r%% == 0 goto :Messagebox >>%SystemDrive%\IR6\Check.bat
    echo cscript.exe /b %%windir%%\system32\slmgr.vbs /rearm >>%SystemDrive%\IR6\Check.bat
    echo net stop sppsvc ^>NUL >>%SystemDrive%\IR6\Check.bat
    echo net start sppsvc ^>NUL >>%SystemDrive%\IR6\Check.bat
    echo schtasks /query ^| FINDSTR /i "IR6" ^>nul >>%SystemDrive%\IR6\Check.bat
    echo if %%errorlevel%%==0 ( >>%SystemDrive%\IR6\Check.bat
    echo 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 >>%SystemDrive%\IR6\Check.bat
    echo schtasks /create /tn "Hybrid2" /tr "%%SystemDrive%%\IR6\Check.bat" /sc onlogon /rl highest /f ^>nul >>%SystemDrive%\IR6\Check.bat 
    echo ) >>%SystemDrive%\IR6\Check.bat
    echo echo F ^| xcopy "%%systemdrive%%\IR6\IR6Bkup.theme" /s /q "%%windir%%\resources\Themes" /V /Y ^>nul >>%SystemDrive%\IR6\Check.bat
    echo start rundll32.exe Shell32.dll,Control_RunDLL desk.cpl desk,@Themes /Action:OpenTheme /File:"C:\Windows\Resources\Themes\IR6Bkup.theme">>%SystemDrive%\IR6\Check.bat
    echo reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes" /t REG_SZ /v CurrentTheme /d "%%windir%%\resources\Themes\IR6Bkup.theme" /f ^>NUL >>%SystemDrive%\IR6\Check.bat
    echo goto :Exit >>%SystemDrive%\IR6\Check.bat
     
  2. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,771
    7,713
    210
    Will check ASAP but I'll have to sleep first, sorry. :eekout:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    :sleep2:...lol
     
  4. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,771
    7,713
    210
    Currently installing test VMs - again. :coffee:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    #645 s1ave77, Jun 25, 2013
    Last edited by a moderator: Apr 20, 2017
    Found a little bug, in case the %themefile% varialble contains a space:
    Code:
    echo for %%%%F in (%%themefile%%) do set theme=%%%%~nF>>%SystemDrive%\IR6\Check.bat
    should be:
    Code:
    echo for %%%%F in ("%%themefile%%") do set theme=%%%%~nF>>%SystemDrive%\IR6\Check.bat
    It´s 13th line in write part (line 200).
     
    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
    #646 timesurfer, Jun 25, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
  7. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,771
    7,713
    210
    Will start testing now, using that latest .bat - Starter x86 and Home Basic x64. Let's see...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,771
    7,713
    210
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,771
    7,713
    210
    All cycles completed. Just celebrated virtual X-Mas. Now waiting for the black screen to happen.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,771
    7,713
    210
    #651 Carlos Detweiller, Jun 25, 2013
    Last edited by a moderator: Apr 20, 2017
    Windows Starter:
    Code:
    Windows Version: Windows 7 Starter
    Press any key to continue . . .
    Home Basic:
    Code:
    Windows Version: Windows 7 Home Basic
    Press any key to continue . . .
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    Easiest way would be to skip both editions for Backup and Restore.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,771
    7,713
    210
    With the little inconvenience of the Home Basic user losing his background.

    I got impatient and installed KB971033 :D - Success!

    Now both Starter and Home Basic have black screen and watermark.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    No clue how this is handled in Home Basic.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,771
    7,713
    210
    #656 Carlos Detweiller, Jun 26, 2013
    Last edited by a moderator: Apr 20, 2017
    OK, Starter is a stupid son of a...
    1. It loses background in Notification.
    2. It doesn't restore even the basic background and stays at black.
    3. The user has no way of resetting the background, either, as there's no UI.
    4. The Wallpaper reg key (HKCU\\ControlPanel\\Desktop) is not restored...
    5. ...except when you try to set a (different) Wallpaper manually. Way to go, MS.

    Final conclusion:
    Code:
    A: For Enterprise, Ultimate, Professional, Home Premium ---> Use the Themes Manager.
    B: For Home Basic ---> Backup and restore the TranscodedWallpaper (C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg).
    C: For Starter ---> Simply reset the Wallpaper value in HKCU\\ControlPanel\\Desktop to "%windir%\web\wallpaper\windows\img0.jpg" - it's the only value allowed.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,455
    989
    60
    Muwhahaha. My TranscodedWallpaper.jpg line of code in the theme backup/restore is needed then.
     
    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
    #658 timesurfer, Jun 26, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
  18. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,455
    989
    60
    You should check to see what task runs that.

    Lets say its personal.exe

    CMD Type: Taskkill /IM /F personal.exe
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  19. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,771
    7,713
    210
    We had that already. Unfortunately it's Explorer.exe. o_O

    Does VBS have window handling (window class or title)?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...