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

    Humphrey MDL Expert

    Dec 13, 2011
    1,455
    989
    60
    #241 Humphrey, Apr 21, 2013
    Last edited by a moderator: Apr 20, 2017
    As far as my last post goes, I think the purple text needs to be called once the script (Duality, IR6, or Check) checks the rearm count.



    Here is a check.bat excerpt.

    Code:
    wmic path %spp% get LicenseStatus /format:list 2>nul | findstr /i 5 >nul 2>&1
    if %errorlevel%==0 goto :Rearm
    if %errorlevel%==1 goto :Backup
    
    :Backup
    echo F | xcopy "%themefile%" "%IR6backup%\IR6Bkup.theme" /Y >NUL
    goto :Exit
    
    :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 :Reinstall
    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
    )
    
    
    echo F | xcopy "%themefile%" "%IR6backup%\IR6Bkup.theme" /Y >NUL
    reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes"  /t  REG_SZ /v CurrentTheme /d "C:\Windows\resources\Themes\IR6Bkup.theme" /f >NUL
    %IR6backup%\IR6Bkup.theme
    goto :Exit
    
    :ReinstallIR6
    
    msgbox.vbs "Duality 420" "Your 180 day free trial has ended, do you wish to install IR6 again?" 4
    IF %ERRORLEVEL% EQU 6 (GOTO reinconfirm) ELSE (IF %ERRORLEVEL% EQU 7 (GOTO UninstallIR6))
    
    :reinconfirm
    
    CLS
    REG  ADD "HKLM\SOFTWARE\Microsoft\Windows   NT\CurrentVersion\SoftwareProtectionPlatform\Activation" /v   NotificationDisabled /t REG_DWORD /d 0 /f >NUL
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. 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...
  3. qewlpal

    qewlpal MDL Addicted

    Jun 25, 2010
    575
    2,014
    30
    Need to change this to
    IF %ERRORLEVEL% EQU 6 (call :ReinstallIR6) ELSE (IF %ERRORLEVEL% EQU 7 (call :UninstallIR6))
    or as Humphrey mentioned use GOTO
     
    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
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    Got to do something be back in little while to do rearm folder stuff and finish off adding Check.bat to IR6 install and Check.bat to Check.bat IR6 re-install :eek:...lol
     
  6. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    #246 s1ave77, Apr 21, 2013
    Last edited by a moderator: Apr 20, 2017
    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
    #247 s1ave77, Apr 21, 2013
    Last edited by a moderator: Apr 20, 2017
    Code:
    msgbox.vbs "Duality 420" "Your 180 day free trial has ended, do you wish to install IR6 again?" 4
    This is the only part prompting an error that command is either wrong written or couldnĀ“t be found :hmm:.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. qewlpal

    qewlpal MDL Addicted

    Jun 25, 2010
    575
    2,014
    30
    #248 qewlpal, Apr 21, 2013
    Last edited by a moderator: Apr 20, 2017
    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
    This is true, OR!, make it create the msgbox.vbs with an echo. output. Make sure its in the %systemdrive%\Rearm folder.
     
    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
    #250 s1ave77, Apr 21, 2013
    Last edited by a moderator: Apr 20, 2017
    Code:
    ::reinstall choice
    :Messagebox
    echo set args=WScript.Arguments >msgbox.vbs
    echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0)) >>msgbox.vbs
    msgbox.vbs "Duality 420" "Your 180 day free trial has ended, do you wish to install IR6 again?" 4
    if exist msbox.vbs del /s /q msgbox.vbs >nul
    IF %ERRORLEVEL% EQU 6 call :ReinstallIR6
    IF %ERRORLEVEL% EQU 7 call :UninstallIR6
    
    
    That way it works for me :D.
     
    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
    #251 timesurfer, Apr 21, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
  12. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,093
    24,397
    340
    #252 s1ave77, Apr 21, 2013
    Last edited by a moderator: Apr 20, 2017
    Files that will be in Rearm folder:

    Code:
    Backup folder
    IORRT.bat 
    Check.bat
    IR6Bkup.theme >>> will be in Backup folder
    msgbox.vbs >>> is created on the fly and deleted afterwards :D.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. qewlpal

    qewlpal MDL Addicted

    Jun 25, 2010
    575
    2,014
    30
    I only meant that he used that in his previous code :) Everyone knew it was you who referred it..There is no question of leaving you behind, this is your thread and this is your project, we are just helping what we can..
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #254 timesurfer, Apr 21, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Ok but I'd rather not spend time doing it if you already have it done...lol

    So am I going to put stuff in D420 and Check.bat or are you guys cause there's no reason for both us to do it...lol

    Can I finish D420 and Check.bat or let you?

    I'm ok with either just want to know cause you guys are tearing it up :eek: in a good way...lol

    I know just feel like we're going the speed of light and I am on ten speed :suicide:...lol

    Thanks
     
  15. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    @slave77 please clear out your inbox as it is quite full

    :shisha:

    OMG Humphrey doesn't want to be friends like slave77 :suicide:...lol

    Carlos :eek:

    Everyone else except nazi's :poop:
     
  16. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #256 timesurfer, Apr 21, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Here is code to make folder and file create in location that will go in D420 and Check.bat IR6reinstall

    Notice what has >nul or not?

    set/mkdir/if/schtask/echo/RD stuff = No :suicide:

    IORRT code

    Code:
    SET file=%SystemDrive%\Check
    IF EXIST %file% attrib -h %file%
    RD /S /Q  %file%
    mkdir "%SystemDrive%\IORRT"
    net stop osppsvc >NUL
    xcopy /cheriky "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform" "%SystemDrive%\IORRT\Backup\Files\Tokens" >NUL
    mkdir "%SystemDrive%\IORRT\Backup\Registry"
    reg save "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform" %SystemDrive%\IORRT\Backup\Registry\OfficeSPPInfo.hiv >NUL
    net start osppsvc >NUL
    SET file=%SystemDrive%\IORRT\IORRT.bat
    IF EXIST %file% attrib -h %file% 
    echo @echo off >%file%
    echo net stop osppsvc >>%file%
    echo xcopy /cheriky "%SystemDrive%\IORRT\Backup\Files\Tokens" "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform" >>%file%
    echo REG DELETE HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform /f >>%file%
    echo REG ADD HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform /f >>%file%
    echo reg restore "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform" %SystemDrive%\IORRT\Backup\Registry\OfficeSPPInfo.hiv >>%file%
    echo net start osppsvc >>%file%
    echo IF Exist "%ProgramFiles%\Microsoft Office\Office15\OSPPREARM.exe" ( >>%file%
    echo "%ProgramFiles%\Microsoft Office\Office15\OSPPREARM.exe" >>%file%
    echo ) ELSE ( "%programfiles(x86)%\Microsoft Office\Office15\OSPPREARM.exe" >>%file%
    echo ) >>%file%
    echo schtasks /delete /tn "IORRT" /f >>%file%
    echo schtasks /create /tn "IORRT" /tr "%SystemDrive%\IORRT\IORRT.bat" /sc daily /mo 1 /ru "" >>%file%
    IR6 code

    Code:
    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%
    Go at it :roflmao:
     
  17. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,455
    989
    60
    What, when was this?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  18. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #258 timesurfer, Apr 21, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
    So logic is this

    For either IR6/IORRT

    Install

    Code:
    If Rearm folder exists, don't create
    put stuff in Rearm folder
    If Rearm folder doesn't exist, create rearm folder
    put stuff in Rearm folder
    Uninstall

    Code:
    Upon uninstall if opposite program stuff is in Rearm the don't delete Rearm folder or opposite stuff
    Delete current program stuff
    Slave77 will check for rearms/notifications via 0 rearms :p...lol

    Ha ha just kidding

    We could have done my rearm error check but yours is more modern less Neanderthal like my idea :magiccarpet:
     
  19. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    Humphrey :hug2: TS
     
  20. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,455
    989
    60
    #260 Humphrey, Apr 21, 2013
    Last edited by a moderator: Apr 20, 2017

    What we doing with this? Change the file output to the rearm folder?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...