lol...The code is on my last post @CODYQX4 Thanks I'll try to put that to work and let you know. Note: I was able to reproduce error 0xc004d307 by installing over present install so maybe I make it to check if installed and if then msg to uninstall before reinstall...lol But if I uninstall then install it will work forever both task ran and actual install of OR4 Thanks guys for your input and testing
Now I gotta figure out how to insert your back up and maybe some part of your installer code into my console Here is that code Code: @echo off REM Goto Batch File Directory cd /D %~dp0 ECHO Press any key to install AutoRearm? pause > nul mkdir "%SystemDrive%\OR4" COPY /Y "%~dp0AutoRearm.exe" "%SystemDrive%\OR4\AutoRearm.exe" COPY /Y "%~dp0AutoRearmTask.cmd" "%SystemDrive%\OR4\AutoRearmTask.cmd" cd /D "%SystemDrive%\OR4\" AutoRearm.exe /backup pause exit and this for the task: Code: @echo off REM Goto Batch File Directory cd /D %~dp0 del /f /q AutoRearm.log AutoRearm.exe FOR /F "delims=: tokens=2" %%i IN (AutoRearm.log) DO set status=%%i echo %status% | find "Rearm Succeeded" > nul if %ERRORLEVEL% == 0 ( echo Rearm Succeeded! pause exit ) ELSE ( del /f /q AutoRearm.log AutoRearm.exe /restore FOR /F "delims=: tokens=2" %%i IN (AutoRearm.log) DO set status=%%i echo %status% | find "Restore Successful" > nul if %ERRORLEVEL% == 0 ( echo Restore Succeeded! AutoRearm.exe pause exit ) ELSE ( Echo Restore Failed! pause exit ) ) pause
I wasn't meaning a pre-made...lol I meant if you back up something I'm not at the moment I have to figure how to put that in there and restore Edit: Now this is all you back up? "REG DELETE HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPl atform /f" "REG ADD HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPl atform /f" "REG RESTORE HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPl atform Backup.hiv" I will try to amend my backup/restore then I'll see if I can figure out how to check if OR4 is installed which I guess I can just check OR4 in c:\ or if task is installed. So this is my backup xcopy /cheriky "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform" "C:\OR4" reg save "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform" C:\OR4\Backup.hiv /y and my restore echo xcopy /cheriky "C:\OR4" "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform" >>%file% echo reg restore "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform" C:\OR4\Backup.hiv >>%file% So you before restore do second backup. Then you attempt restore of first backup If fail restore second backup Attempt restore of first backup If succeed rearm If not what then? And your also checking if rearm yes/no but when?
This is actually used in the restore part Code: xcopy /cheriky "C:\OR4" "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform" REG DELETE HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform /f REG ADD HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform /f reg restore "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform" C:\OR4\Backup.hiv
Are you saying there's no difference? or I need to add something? What's up with the delete. We don't have that and we use save instead of add?
I hope the following will clear your doubts Before restoring the backup Delete the OfficeSoftwareProtectionPlatform key Add an empty OfficeSoftwareProtectionPlatform key Restore the backup of OfficeSoftwareProtectionPlatform key
I'm confused am I changing something or leaving it. I simply don't understand what we're doing? Is this to improve what I already have? Here is what I have so far Code: @echo off @color 9A title OfficeRearm4 :MAINMENU mode con: cols=64 lines=11 CLS echo. echo. echo. OfficeRearm4 by timesurfer echo. echo. An alternative Office 2010 Rearm Concept Solution echo. echo. A. Install OR4 echo. B. Uninstall OR4 echo. C. OR4 Status echo. D. Exit echo. :CHOOSEACTION set /p userinp= ^ Make your selection: set userinp=%userinp:~0,1% if /i "%userinp%"=="A" goto InstallOR4 if /i "%userinp%"=="B" goto UninstallOR4 if /i "%userinp%"=="C" goto OR4Status if /i "%userinp%"=="D" goto Exit echo. echo. Try Again... echo. GOTO CHOOSEACTION :InstallOR4 CLS mode con: cols=64 lines=21 title OfficeRearm4 mkdir "C:\OR4" net stop osppsvc xcopy /cheriky "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform" "C:\OR4" reg save "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform" C:\OR4\Backup.hiv /y net start osppsvc SET file=%SystemDrive%\OR4\OR4.bat IF EXIST %file% attrib -h %file% echo @echo off >%file% echo net stop osppsvc >>%file% echo xcopy /cheriky "C:\OR4" "%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" C:\OR4\Backup.hiv >>%file% echo IF Exist "%COMMONPROGRAMFILES%\microsoft shared\OfficeSoftwareProtectionPlatform\OSPPREARM.exe" ( >>%file% echo "%COMMONPROGRAMFILES%\microsoft shared\OfficeSoftwareProtectionPlatform\OSPPREARM.exe" >>%file% echo ) ELSE ( "%COMMONPROGRAMFILES(X86)%\microsoft shared\OfficeSoftwareProtectionPlatform\OSPPREARM.exe" >>%file% echo ) >>%file% echo net start osppsvc >>%file% "C:\Program Files\Common Files\microsoft shared\OfficeSoftwareProtectionPlatform\OSPPREARM.EXE" schtasks /create /tn "Rearm2" /tr %file% /sc daily /mo 30 /RL HIGHEST /f echo. cscript "%PROGRAMFILES%\Microsoft Office\OFFICE14\OSPP.VBS" /dstatus schtasks /query | FINDSTR /I "Rearm2" IF ERRORLEVEL 1 echo Rearm2 Task is not yet Installed echo. Press any key to return to the main menu. pause > nul GOTO MAINMENU ) :UninstallOR4 CLS mode con: cols=64 lines=10 title OfficeRearm4 echo.Please Wait... echo. SET file=%SystemDrive%\OR4 IF EXIST %file% attrib -h %file% RD /S /Q %file% schtasks /delete /tn "Rearm2" /f echo. Press any key to return to the main menu. pause > nul GOTO MAINMENU ) :OR4Status mode con: cols=64 lines=21 title OfficeRearm4 cscript "%PROGRAMFILES%\Microsoft Office\OFFICE14\OSPP.VBS" /dstatus schtasks /query | FINDSTR /I "Rearm2" IF ERRORLEVEL 1 echo Rearm2 Task is not yet Installed echo. Press any key to return to the main menu. pause > nul GOTO MAINMENU ) :Exit Thank you
Just add the following lines after echo xcopy /cheriky "C:\OR4" "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform" >>%file% Code: echo REG DELETE HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform /f >>%file% echo REG ADD HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform /f >>%file% You had asked Cody what he does to make his restore work and he gave you the answer.
Thanks for your help MD. I thought your comment was in realation to his advice but i wasn't certain nor what to do I change my last post to reflect the changes
After you make changes suggested by MD, you can make this changes to the script: Code: @echo off @color 9A title OfficeRearm4 :MAINMENU mode con: cols=64 lines=11 CLS echo. echo. echo. OfficeRearm4 by timesurfer echo. echo. An alternative Office 2010 Rearm Concept Solution echo. echo. A. Install OR4 echo. B. Uninstall OR4 echo. C. OR4 Status echo. D. Exit echo. :CHOOSEACTION set /p userinp= ^ Make your selection: set userinp=%userinp:~0,1% if /i "%userinp%"=="A" goto InstallOR4 if /i "%userinp%"=="B" goto UninstallOR4 if /i "%userinp%"=="C" goto OR4Status if /i "%userinp%"=="D" goto Exit echo. echo. Try Again... echo. GOTO CHOOSEACTION ) and you can delete the @Color code from the rest of script, no need to put it everywhere, the color will remain, as for the change above its for when you go back to Main the size will change to original size. If you put the code before :Mainmenu the script will no read the size again when go back.. You can use Code: D:Exit blah blah blah blah blah blah goto End :End exit /b
/cheriky Please can you explain the term "/cheriky" in the line above. Is it an option of the XCOPY command? and what it does? excuse my english thank in advance
Yeah those are options of XCOPY but clubbed together. /C Continues copying even if errors occur. /H Copies hidden and system files also. /E Copies directories and subdirectories, including empty ones. /R Overwrites read-only files. /I If destination does not exist and copying more than one file, assumes that destination must be a directory. /K Copies attributes. Normal Xcopy will reset read-only attributes. /Y Suppresses prompting to confirm you want to overwrite an existing destination file.
I still get the error 0xc004d307 that doesn't allow restore/rearm then I have to use TOOLKIT to do full restore so what's the deal. Why does mine fail even when I uninstall first then install. Would be nice for the toolkit restore to work in place of mine but aren't they the same now so I'm confused what my next step is? I know the error means outta rearms but when you restore rearms are suppose to be there. Code: @echo off @color 9A title OfficeRearm4 :MAINMENU mode con: cols=64 lines=11 CLS echo. echo. echo. OfficeRearm4 by timesurfer echo. echo. An alternative Office 2010 Rearm Concept Solution echo. echo. A. Install OR4 echo. B. Uninstall OR4 echo. C. OR4 Status echo. D. Exit echo. :CHOOSEACTION set /p userinp= ^ Make your selection: set userinp=%userinp:~0,1% if /i "%userinp%"=="A" goto InstallOR4 if /i "%userinp%"=="B" goto UninstallOR4 if /i "%userinp%"=="C" goto OR4Status if /i "%userinp%"=="D" goto Exit echo. echo. Try Again... echo. GOTO CHOOSEACTION :InstallOR4 CLS mode con: cols=64 lines=21 title OfficeRearm4 mkdir "%SystemDrive%\OR4" net stop osppsvc xcopy /cheriky "%ALLUSERSPROFILE%\Microsoft\OfficeSoftwareProtectionPlatform" "C:\OR4" reg save "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform" C:\OR4\Backup.hiv /y net start osppsvc SET file=%SystemDrive%\OR4\OR4.bat IF EXIST %file% attrib -h %file% echo @echo off >%file% echo net stop osppsvc >>%file% echo xcopy /cheriky "C:\OR4" "%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" C:\OR4\Backup.hiv >>%file% echo IF Exist "%COMMONPROGRAMFILES%\microsoft shared\OfficeSoftwareProtectionPlatform\OSPPREARM.exe" ( >>%file% echo "%COMMONPROGRAMFILES%\microsoft shared\OfficeSoftwareProtectionPlatform\OSPPREARM.exe" >>%file% echo ) ELSE ( "%COMMONPROGRAMFILES(X86)%\microsoft shared\OfficeSoftwareProtectionPlatform\OSPPREARM.exe" >>%file% echo ) >>%file% echo net start osppsvc >>%file% "C:\Program Files\Common Files\microsoft shared\OfficeSoftwareProtectionPlatform\OSPPREARM.EXE" schtasks /create /tn "Rearm2" /tr %file% /sc daily /mo 30 /RL HIGHEST /f echo. cscript "%PROGRAMFILES%\Microsoft Office\OFFICE14\OSPP.VBS" /dstatus schtasks /query | FINDSTR /I "Rearm2" IF ERRORLEVEL 1 echo Rearm2 Task is not yet Installed echo. Press any key to return to the main menu. pause > nul GOTO MAINMENU ) :UninstallOR4 CLS mode con: cols=64 lines=10 title OfficeRearm4 echo.Please Wait... echo. SET file=%SystemDrive%\OR4 IF EXIST %file% attrib -h %file% RD /S /Q %file% schtasks /delete /tn "Rearm2" /f echo. Press any key to return to the main menu. pause > nul GOTO MAINMENU ) :OR4Status mode con: cols=64 lines=21 title OfficeRearm4 cscript "%PROGRAMFILES%\Microsoft Office\OFFICE14\OSPP.VBS" /dstatus schtasks /query | FINDSTR /I "Rearm2" IF ERRORLEVEL 1 echo Rearm2 Task is not yet Installed echo. Press any key to return to the main menu. pause > nul GOTO MAINMENU ) :Exit
What is the counter going to achieve? If people have different current rearms how will it help? How did you overcome any errors for this concept to work?