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. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    Will look at this tomorrow, there should be implemented the version check and some jumps in case of Starter and Home Basic, although they shouldn´t be very widespread :D. Only a little challenge to get the write part properly working.

    Personally i have no problem to close the personalization window, as it normally happens very seldom. Unfortunately i only found some crude VBS scripts which didn´t always work as expected.

    The messages can be easily integrated, but mostly they will be shown only a fraction of a moment, not shure, if a ping makes sense here. Unfortunately this can´t run fully hidden, as it requires user interaction.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,455
    989
    60
    What if Explorer.exe is closed and then reopened? Just have to make sure that it is opened without administrative properties.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,771
    7,713
    210
    1. There may be multiple Explorer.exe open - which one to close?
    2. Restarting Explorer.exe causes loss of some tray icons (if it was the primary shell).
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,455
    989
    60
    Well if we overlooked the tray icons (ppft) then it could be: taskkill /F /FI "IMAGENAME eq explorer.exe"

    I think your right on the icons.

    What about signing the user out?

    Shutdown -L
     
    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
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,455
    989
    60
    Whats different in this slave?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    #667 s1ave77, Jun 26, 2013
    Last edited by a moderator: Apr 20, 2017
    Version check:
    Code:
    for /f "tokens=2,3,4,5,6,7 delims= " %%a in ('wmic os get caption') do set ver=%%a %%b %%c %%d %%e %%f
    :loopV
    if "%ver:~-1%"==" " set "ver=%ver:~0,-1%" & goto :loopV
    
    Jumps in case Starter or Home Basic is found:
    Code:
    :Backup
    if "%ver%" == "Windows 7 Starter" ( goto :Exit )
    if "%ver%" == "Windows 7 Home Basic" ( goto :BackupHB )
    if exist "%systemdrive%\IR6\IR6Bkup.theme" del /s /q "%systemdrive%\IR6\IR6Bkup.theme" >nul
    echo F | xcopy "%themefile%" /s /q "%systemdrive%\IR6\" /Y /V >nul 
    ren "%systemdrive%\IR6\%theme%.theme" "IR6Bkup.theme"
    goto :Exit
    :BackupHB
    xcopy "%wppath%\TranscodedWallpaper.jpg" /s /q "%%systemdrive%%\IR6" /Y >nul
    goto :Exit 
    :Rearm
    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 
    schtasks /create /tn "Hybrid2" /tr "%SystemDrive%\IR6\Check.bat" /sc onlogon /rl highest /f >nul  
    ) 
    if "%ver%" == "Windows 7 Starter" ( goto :RestoreS )
    if "%ver%" == "Windows 7 Home Basic" ( goto :RestoreHB )
    echo F | xcopy "%systemdrive%\IR6\IR6Bkup.theme" /s /q "%windir%\resources\Themes" /Y /V >nul
    start rundll32.exe Shell32.dll,Control_RunDLL desk.cpl desk,@Themes /Action:OpenTheme /File:"C:\Windows\Resources\Themes\IR6Bkup.theme"
    reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes" /t REG_SZ /v CurrentTheme /d "%windir%\resources\Themes\IR6Bkup.theme" /f >NUL 
    goto :Exit 
    :RestoreS
    reg add "HKCU\\ControlPanel\\Desktop" /f /v "Wallpaper" /d "%windir%\web\wallpaper\windows\img0.jpg" /t "REG_SZ" >nul
    goto :Exit 
    :RestoreHB
    xcopy "%systemdrive%\IR6\TranscodedWallpaper.jpg" /s /q "%wppath%" /Y >nul
    goto :Exit
    
    
     
    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
    Home Basic:
    1. Inserted Pause into Duality just before initial reboot into WinRE.
    2. Installed IR6.
    3. Drop-in replaced the check.bat.
    4. Did the initial C:IR6 stuff.
    5. When returning into Windows, the ''IR6 Check Task'' stays up forever. I see an XCopy process running, but nothing ever happens. o_O
    Could it be hanging at the question if the destination is a directory/file?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,455
    989
    60
    If hanging cause of that then:


    ECHO F| xcopy "%wppath%\TranscodedWallpaper.jpg" /s /q "%%systemdrive%%\IR6" /Y >nul

    II think it is.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    A ping would only extend the torture of the Check.bat being visible so we'll put what messages make sense to put

    Yea it would be great to close the personalization window after restore

    I actually get a message in check.bat console as it closes that says something about a pipe (No jokes please :shisha:...lol)
     
  11. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    Did you check with the attached script?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,771
    7,713
    210
    Yes. With the echo F modification by Humphrey it doesn't hang, but doesn't create a backup, either...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    As it is copying an existing file, that shouldn´t matter in this case. Maybe the path is different here?

    Need some sleep now, will set up VMs later :D.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,771
    7,713
    210
    Still checking, inserting breakpoints.
     
    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
    #675 Carlos Detweiller, Jun 26, 2013
    Last edited by a moderator: Apr 20, 2017
    Gotcha! That line works. For some reason the systemdrive variable had double percent signs (xcopy "%wppath%\TranscodedWallpaper.jpg" /s /q "%%systemdrive%%\IR6" /Y >nul).

    Code:
    echo F | xcopy "%wppath%\TranscodedWallpaper.jpg" /s /q "%systemdrive%\IR6\" /Y >nul
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    #676 s1ave77, Jun 26, 2013
    Last edited by a moderator: Apr 20, 2017
    My bad :eek:...didn´t check this :doh:.

    BTW: Was from an old version of the write part, i failed to correct all doubled signs.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,771
    7,713
    210
    New problems with Home Basic. Backup works, but restore needs two parts.

    1. Copying the TranscodedWallpaper.jpg file back.
    2. Set the Wallpaper value in HKCU\ControlPanel\Desktop to %APPDATA%\Microsoft\Windows\Themes\TranscodedWallpaper.jpg (since Windows empies it).

    Even then, I needed to log out and back in...

    Next is Starter. Oh joy.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  18. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    OK...clear, will implement this :good3:.

    Then LogOff/On will probably be required for Starter likewise.
     
    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
    #679 Carlos Detweiller, Jun 26, 2013
    Last edited by a moderator: Apr 20, 2017
    Code:
    reg add "HKCU\\ControlPanel\\Desktop" /f /v "Wallpaper" /d "%AppData%\Microsoft\Windows\Themes\TranscodedWallpaper.jpg" /t "REG_SZ" >nul
    This is what I used.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  20. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,771
    7,713
    210
    #680 Carlos Detweiller, Jun 26, 2013
    Last edited by a moderator: Apr 20, 2017
    Code:
    reg add "HKCU\Control Panel\Desktop" /f /v "Wallpaper" /d "%AppData%\Microsoft\Windows\Themes\TranscodedWallpaper.jpg" /t REG_SZ >nul
    Correction to the reg command. It is "Control Panel" (with a space), and it must be single backslashes.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...