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

    Powershell script to run commands remotely via TRIGGERcmd

    Instructions
    1
    1
    2068
    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.
    • Russ
      Russ last edited by

      Here's an example Powershell script you could use to call the TRIGGERcmd API to run a remote command:

      $postdata = @{
          trigger='notepad'
          computer='Laptop'
          # params='optionalparameter.txt'
      }
      
      $token=Get-Content ~\.TRIGGERcmdData\token.tkn
      
      $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
      $headers.Add("authorization", "Bearer " + $token)
      
      $json = $postdata | ConvertTo-Json
      $response = Invoke-RestMethod 'https://www.triggercmd.com/api/run/triggerSave' -Method Post -Body $json -ContentType 'application/json' -Headers $headers

      Russell VanderMey

      1 Reply Last reply Reply Quote 0
      • Referenced by  Russ Russ 
      • Referenced by  Russ Russ 
      • First post
        Last post