Well just let me clarify. I don't want any task created msg's. It's the task that works with error check 1. If no rearms then give No rearms detected msg 2. If task is installed then go ahead and rearm and re-create task 3. If task is not installed then rearm but DO NOT create task I do this so anyone can use rearm part but if they don't have IR5 task installed as marker for IR5 installed then task shouldn't get created hence only those who have task installed get to re-create task
Crashes console and doesn't re-create task but does rearm When crash it is too fast to see msg or error's
Try changing the "schtasks /create /tn ..." line to "schtasks /change /tn ...". It looks like the problem is that if the task already exists, we cannot use /create. The other option would be to remove the task and then re-create it.
Are you sure? In IORRT we did that Here is what that would look like Code: :RearmIR5 CLS cscript.exe /b %windir%\system32\slmgr.vbs /rearm IF %ERRORLEVEL% NEQ 0 ( echo No rearms detected... ping -n 5 127.0.0.1 >nul GOTO Start ) ELSE ( net stop sppsvc >NUL net start sppsvc >NUL echo Rearm completed successfully... ) schtasks /query /tn | FINDSTR "IR5" >NUL if %errorlevel%==0 echo schtasks /delete /tn "IR5" /f schtasks /create /tn "IR5" /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 I think it's in the if/else stuff but I dunno
Still crashes but does rearm and doesn't create task so I think it's not the task part but the logic after rearm where we decide to create task based on IR5 task already being present or not Thanks for your help
Let me just get this straight (since I cannot test it myself). 1) We try to rearm and if it fails, we give the "No rearms detected..." message and go back to menu. 2) We check the tasks for IR5 to see if it exists. If it does, we are looking to re-create/modify the existing task. If it is not there, we just return to menu. Does that sound right?
Almost...lol 1) We try to rearm and if it fails, we give the "No rearms detected..." message and go back to menu. 2) We check the tasks for IR5 to see if it exists. If it does, we re-create the existing task (We can just create task and it replaces old with new so that is no problem) 3) If it doesn't then we skip the task creation and just go back to menu * We do this so people can use Trilogy to rearm their windows if they are beginners and if they don't have IR5 installed but need to rearm
If you think you can leave the "schtasks /delete" line out then feel free but with XP, it doesn't like it. Keep in mind that IR5 is for Win7, so not working in XP is fine and would not require changing.
Did you happen to try it with the "delete" line in place? just wondering if it does make a difference. Or put a pause after the "create" line to see what error comes up.
My response was in answering that question so it isn't the problem but the way we try to do two error checks in this rearm fuction Before I wanted to not do task creation for non-IR5 users it worked fine so it's the second errorlevel that's broken and crashes and doesn't do task creation if IR5 task is installed
To help determine the problem, can you add a pause line after your "schtasks /create" line so that any resulting errors are displayed? Code: ... schtasks /query /tn | FINDSTR "IR5" >NUL if %errorlevel%==0 ( schtasks /create /tn "IR5" /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 pause ) GOTO Start Or, you can just open up a command prompt and paste the entire "schtasks /create ..." line in and see what happens.
Yes thanks I've been at this all day and yesterday...lol Ok I tried it and still won't create task but rearms and crashes and now I have to reinstall IR5 to get back rearms to further test
There should be no reason for it to crash unless the "schtasks /create" line has an error (or you need to delete the task first). Can you try opening a command prompt and entering the entire "schtasks /query" line and see if there are any errors. Then try entering the "schtasks /create" line and see if there are any errors? I don't see any issues with the errorlevel logic and the cause of the crash must be related to the "create" line. Just for kicks, did you also try adding the "schtasks /delete" line before the "schtasks /create" to see if anything else happens? If we don't get anywhere with this, I'll try getting Win7 up and try it myself but it'll probably take me a couple of days before I can do this. Hope your system is not screwed up too much. I'll catch you tomorrow.