Ad Widget

Collapse

Timeout while executing a shell script.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Richard341
    Junior Member
    • Sep 2022
    • 8

    #1

    Timeout while executing a shell script.

    I tried running following shell script remotely, it just doesn't seem to work. Batch files run just fine.
    Remotecommands and AllowKey=System.Run[*] is already enabled.
    Every time I test my item it loads for a bit and gives me an error message ("Timeout while executing a shell script.")
    I already tried setting timeout=30 in the config file, unfortunately it didn't solve my issue

    Here is the powershell script:

    $userb = Get-ADGroupMember "Formel1 Fil1"
    $userb.name

    All it does is just getting all members of a group in active directory.

  • Bartosz Mickiewicz
    Junior Member
    • Oct 2022
    • 27

    #2
    You have to change the timeout in both server's and agent's config files. Also, do your script finish in 30 seconds?

    Comment

    • Richard341
      Junior Member
      • Sep 2022
      • 8

      #3
      Originally posted by bartosz.mickiewicz
      You have to change the timeout in both server's and agent's config files. Also, do your script finish in 30 seconds?
      I changed the timeout in the server's and agent's config files, just as you told. Unfortunately it still doesn't work. It spits out the same error message.
      My script definitely finishes in under 30 seconds, maybe even in under one second. I tried changing the script to something very very simple:
      Get-Help
      but it still gives me a timeout, despite its simplicity.
      Looks like every power shell script timeouts.

      Comment

      • Bartosz Mickiewicz
        Junior Member
        • Oct 2022
        • 27

        #4
        Maybe you can try following this video and see if this helps, I can imagine that system.run by default tries to use this command in CMD not PowerShell, you can try changing the command to:
        powershell $userb = Get-ADGroupMember "Formel1 Fil1"; $userb.name;
        You can try running this on the destination host from CMD and see if it works as intended.​

        Comment

        • Richard341
          Junior Member
          • Sep 2022
          • 8

          #5
          Hello, the issue is resolved,
          writing system.run["powershell.exe -executionpolicy bypass -File "C:\Path\FORMEL1_Fil1.ps1"] as the Key did the job for me.
          I really appreciate the time and effort you put into helping me, thank you : )

          Comment

          Working...