• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
TRIGGERcmd
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Have Alexa say result of long running process, like chkdsk

Alexa
1
1
973
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R
    Russ
    last edited by Russ Feb 13, 2022, 6:42 PM Feb 12, 2022, 11:21 PM

    This is probably not something for a beginner, but it uses lot of TRIGGERcmd functionality, so it's a good learning experience.

    I made this video to explain the process.

    Prerequisites:

    • Link the TRIGGERcmd Smart Home Alexa skill
    • Link the TRIGGERcmd Alexa skill
    • Install the tcmd command line tool.

    This is how it works:

    • I say, "Alexa, turn on check disk"
    • TRIGGERcmd Smart Home Alexa skill runs the TRIGGERcmd command called chkdsk_run.
    • d:\tools\run_chkdsk.bat script runs, including chkdsk 😄 > d:\tools\log.chk, then tcmd -c russhp -t chkdsk_routine.
    • My chkdsk report Alexa routine runs with custom action: ask TRIGGER C M D to run report
    • TRIGGERcmd Alexa skill runs the TRIGGERcmd command called chkdsk_report.
    • d:\tools\report_chkdsk_status.bat script runs, including %USERPROFILE%\.TRIGGERcmdData\SendResult.bat good (assuming the chkdsk log shows "No further action is required.")
    • TRIGGERcmd Alexa skill audibly replies, "Check disk good"

    My three TRIGGERcmd commands:

    9e55fa69-1870-4d2a-ba47-6db62e86fafa-image.png

    20fbf687-d128-4288-85d7-bfb627d2b0c1-image.png

    My d:\tools\run_chkdsk.bat file:

    del d:\tools\log.chk
    chkdsk c: > d:\tools\log.chk
    tcmd -c russhp -t chkdsk_routine
    

    My report_chkdsk_status.bat file:

    type d:\tools\log.chk | find "No further action is required."
    IF ERRORLEVEL 1 goto bad
    goto good
    
    :good
    %USERPROFILE%\.TRIGGERcmdData\SendResult.bat good
    goto end
    
    :bad
    %USERPROFILE%\.TRIGGERcmdData\SendResult.bat bad
    
    :end
    

    My Alexa routine:

    chkdsk_routine.png

    Notice the chkdsk_run command is a background command, so make sure you install the background service first, like this:

    b6060ac1-ecc9-4fc4-80fe-ebed6339246d-image.png

    The run_chkdsk.bat needs to run in the background service so it runs as Local System. That gives it access to run chkdsk.exe.

    The run_chkdsk.bat script also includes this command: tcmd -c russhp -t chkdsk_routine
    The tcmd command needs your token.tkn file to authenticate with your TRIGGERcmd account.
    The tcmd command will look for token.tkn in the user's .TRIGGERcmdData folder within the user's profile folder. The TRIGGERcmdAgent background service runs as Local System, and Local System user's profile folder is C:\Windows\System32\config\systemprofile. You'll need to run a cmd window "as administrator" to access that folder, like this:
    6c3a9eb7-7d3c-4b51-bafd-78566fea4a86-image.png

    Run these commands in that cmd window to copy your token.tkn file to the Local System user's .TRIGGERcmdData folder:

    cd C:\Windows\System32\config\systemprofile\
    mkdir .TRIGGERcmdData
    cd .TRIGGERcmdData
    copy %USERPROFILE%\.TRIGGERcmdData\token.tkn .
    

    Russell VanderMey

    1 Reply Last reply Reply Quote 0
    • R Russ pinned this topic on Feb 12, 2022, 11:39 PM
    • R Russ referenced this topic on Feb 12, 2022, 11:41 PM
    • R Russ referenced this topic on Oct 30, 2022, 12:00 AM
    • R Russ referenced this topic on May 23, 2023, 1:00 AM
    1 out of 1
    • First post
      1/1
      Last post