Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. issue with scripts run by ExternalParametersProvider

issue with scripts run by ExternalParametersProvider

Scheduled Pinned Locked Moved Support
3 Posts 2 Posters 28.6k Views
  • 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.
  • A
    A
    AP_ops
    wrote on last edited by
    #1

    Hi

    Windows Batch Scripts executed by the ExternalParametersProvider seem to have issues when they execute other applications. In Powershell Scripts only xcopy.exe doesn't work.
    We are using Windows 2008 R2 as Server and Agent.
    NetXMS Server and Agent is on 1.2.4

    in cmd.exe scripts it seems like it stops executing after the first exe-application was started. this only happens when run by NetXMS Agent, when run manually in cmd.exe it always runs through

    @echo off
    echo ---- MARK >> d:\log_files\netxms_rpc_debug_cmd.log 2>&1
    c:\WINDOWS\System32\ping.exe localhost -n 1 >> d:\log_files\netxms_rpc_debug_cmd.log 2>&1
    c:\WINDOWS\System32\findstr.exe csax d:\csaxtext?.txt >> d:\log_files\netxms_rpc_debug_cmd.log 2>&1
    c:\WINDOWS\System32\robocopy.exe d:\ c:\ csaxtext3.txt /NJH /NP >> d:\log_files\netxms_rpc_debug_cmd.log 2>&1
    c:\WINDOWS\System32\xcopy.exe d:\csaxtext3.txt c:\ /Y >> d:\log_files\netxms_rpc_debug_cmd.log 2>&1
    echo DEBUG_CMD=SOMEVALUE >> d:\log_files\netxms_rpc_debug_cmd.log 2>&1
    

    when you change order of commands, the first one is executed with proper output, the rest is not.
    interestingly, xcopy does not work at all, no output, no copy but still stops execution
    the output of the above script is:

    ---- MARK 

    Pinging localhost [127.0.0.1] with 32 bytes of data:
    Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

    Ping statistics for 127.0.0.1:
        Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 0ms, Average = 0ms

    in powershell all but xcopy work. xcopy won't stop the execution of the hole script but it doesn't do anything and does not show any output. If run manually, it works as expected.

    "---- MARK" | ac d:\log_files\netxms_rpc_debug_ps.log
    c:\WINDOWS\System32\ping.exe localhost -n 1 | ac d:\log_files\netxms_rpc_debug_ps.log
    c:\WINDOWS\System32\xcopy.exe d:\csaxtext3.txt c:\ /Y | ac d:\log_files\netxms_rpc_debug_ps.log
    c:\WINDOWS\System32\findstr.exe csax d:\csaxtext?.txt | ac d:\log_files\netxms_rpc_debug_ps.log
    c:\WINDOWS\System32\robocopy.exe d:\ c:\ csaxtext3.txt /NJH /NP | ac d:\log_files\netxms_rpc_debug_ps.log
    "DEBUG_PS=SOMEVALUE"| ac d:\log_files\netxms_rpc_debug_ps.log
    

    output

    ---- MARK

    Pinging app01.intra.arcplace.ch [127.0.0.1] with 32 bytes of data:
    Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

    Ping statistics for 127.0.0.1:
        Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 0ms, Average = 0ms
    d:\csaxtext3.txt:csax-test

                          1 d:\

    ------------------------------------------------------------------------------

                  Total    Copied  Skipped  Mismatch    FAILED    Extras
        Dirs :        1        0        1        0        0        0
      Files :        1        0        1        0        0        0
      Bytes :        11        0        11        0        0        0
      Times :  0:00:00  0:00:00                      0:00:00  0:00:00

      Ended : Wed Nov 14 15:58:30 2012
    DEBUG_PS=SOMEVALUE

    Agent Config:

    LogFile = D:\log_files\netxms_agent.log
    DebugLevel = 9
    FileStore = C:\NetXMS\var
    SubAgent = ecs.nsm
    SubAgent = ping.nsm
    SubAgent = logwatch.nsm
    SubAgent = portcheck.nsm
    SubAgent = winperf.nsm
    SubAgent = wmi.nsm
    ExternalParametersProvider=powershell.exe d:\cmd_files\netxms_rpc_debug.ps1:5
    ExternalParametersProvider=d:\cmd_files\netxms_rpc_debug.cmd:5
    

    In the Agent Debug(level 9) logs i was unable to find detailed information about the execution of ExternalParamtersProvider only the DCIs requesting their parameters.
    i tested this on two Windows 2008 R2 systems with same agent version. one is part of a domain, the other is not.

    i appreciate any ideas.
    in the end, i need the xcopy in powershell to generate a list of remote files older than a specific date (xcopy /L /D:DATE)

    1 Reply Last reply
    0
    • V
      V
      Victor Kirhenshtein
      wrote on last edited by
      #2

      Hi!

      I try to reproduce this issue, but everything is working on my test system. How do you run agent? Did you try to run it from command line in foreground?

      Best regards,
      Victor

      1 Reply Last reply
      0
      • A
        A
        AP_ops
        wrote on last edited by
        #3

        Hi

        just tried to run the agent from the commandline:
        "C:\NetXMS\bin\nxagentd.exe" -c "C:\NetXMS\etc\nxagentd.conf" -n "NetXMSAgentdW32" -e "NetXMS Win32 Agent" -D 0

        now it works!
        what's the difference?

        usually the agent runs as a windows service using Active Directory user credentials to be able to access network ressources. the user i did run it from the commandline.

        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        Powered by NodeBB Contributors
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups