Trilogy 4.2

Discussion in 'MDL Projects and Applications' started by timesurfer, Feb 11, 2011.

Thread Status:
Not open for further replies.
  1. tomah

    tomah MDL Senior Member

    Sep 25, 2010
    408
    355
    10
    #201 tomah, Feb 25, 2011
    Last edited by a moderator: Apr 20, 2017
    How about this?
     
  2. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    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
     
  3. tomah

    tomah MDL Senior Member

    Sep 25, 2010
    408
    355
    10
    #203 tomah, Feb 25, 2011
    Last edited by a moderator: Apr 20, 2017
    Unfortunately, I'm still on Xp and can't fully test this, but give this a try. Changes are in RED.
     
  4. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    Crashes console and doesn't re-create task but does rearm

    When crash it is too fast to see msg or error's
     
  5. tomah

    tomah MDL Senior Member

    Sep 25, 2010
    408
    355
    10
    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.
     
  6. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #206 timesurfer, Feb 25, 2011
    Last edited by a moderator: Apr 20, 2017
    (OP)
    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
     
  7. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    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 :worthy:
     
  8. tomah

    tomah MDL Senior Member

    Sep 25, 2010
    408
    355
    10
    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?
     
  9. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #209 timesurfer, Feb 25, 2011
    Last edited: Feb 25, 2011
    (OP)
    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
     
  10. tomah

    tomah MDL Senior Member

    Sep 25, 2010
    408
    355
    10
    #210 tomah, Feb 25, 2011
    Last edited by a moderator: Apr 20, 2017
    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.
     
  11. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    Yea I remember now I had to delete just in case for XP with IORRT but no need for Win 7
     
  12. tomah

    tomah MDL Senior Member

    Sep 25, 2010
    408
    355
    10
    So does this work?
     
  13. tomah

    tomah MDL Senior Member

    Sep 25, 2010
    408
    355
    10
    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.
     
  14. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    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
     
  15. tomah

    tomah MDL Senior Member

    Sep 25, 2010
    408
    355
    10
    #216 tomah, Feb 25, 2011
    Last edited by a moderator: Apr 20, 2017
    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.
     
  16. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #217 timesurfer, Feb 25, 2011
    Last edited by a moderator: Apr 20, 2017
    (OP)
    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
     
  17. tomah

    tomah MDL Senior Member

    Sep 25, 2010
    408
    355
    10
    #218 tomah, Feb 25, 2011
    Last edited: Feb 25, 2011
    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.
     
  18. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,524
    4,112
    270
    #219 timesurfer, Feb 25, 2011
    Last edited by a moderator: Apr 20, 2017
    (OP)
  19. tomah

    tomah MDL Senior Member

    Sep 25, 2010
    408
    355
    10
    #220 tomah, Feb 25, 2011
    Last edited by a moderator: Apr 20, 2017