issue with scripts run by ExternalParametersProvider
-
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.4in 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>&1when 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=128Ping 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 = 0msin 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.logoutput
---- 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=128Ping 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-test1 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:00Ended : Wed Nov 14 15:58:30 2012
DEBUG_PS=SOMEVALUEAgent 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:5In 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) -
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 -
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 0now 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.
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