[GH-ISSUE #154] Bug: Fire and Forget Script Forgets to Fire #89

Closed
opened 2026-03-02 02:13:28 +03:00 by kerem · 4 comments
Owner

Originally created by @bradhawkins85 on GitHub (Oct 29, 2020).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/154

I am having issues with Right Click > Run Script as Fire and Forget.
Nothing happens on the client machine.
If I run the same script as Wait for output the action is performed on the client machine and the script returns the expected result.
Debug log does not show anything for the script.
Audit log shows the job regardless fo the method used and both return Before and After values of 'null'

Originally created by @bradhawkins85 on GitHub (Oct 29, 2020). Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/154 I am having issues with Right Click > Run Script as Fire and Forget. Nothing happens on the client machine. If I run the same script as Wait for output the action is performed on the client machine and the script returns the expected result. Debug log does not show anything for the script. Audit log shows the job regardless fo the method used and both return Before and After values of 'null'
kerem closed this issue 2026-03-02 02:13:28 +03:00
Author
Owner

@wh1te909 commented on GitHub (Oct 29, 2020):

that's weird, am not able to reproduce. the fire and forget runs the exact same command as the wait for output just with background=True instead of False.

This is handled by salt currently.
Can you run salt minion in debug mode on the agent please, that way we can see in real time if the command is even reaching the agent and if any errors.
from elevated command prompt:

net stop salt-minion
cd c:\salt
salt-minion-debug.bat

first do the wait for output and you will see in real time the output in the cmd window, then do same for fire and forget

<!-- gh-comment-id:718400813 --> @wh1te909 commented on GitHub (Oct 29, 2020): that's weird, am not able to reproduce. the fire and forget runs the exact same command as the wait for output just with background=True instead of False. This is handled by salt currently. Can you run salt minion in debug mode on the agent please, that way we can see in real time if the command is even reaching the agent and if any errors. from elevated command prompt: ``` net stop salt-minion cd c:\salt salt-minion-debug.bat ``` first do the wait for output and you will see in real time the output in the cmd window, then do same for fire and forget
Author
Owner

@bradhawkins85 commented on GitHub (Oct 29, 2020):

Looks like the command is getting to the agent.

Both methods bombard me with the following:
('C:\salt\bin\lib\site-packages\salt-3001rc1_16_ge92daf88a2-py3.7.egg\salt\modules\zcbuildout.py', '.py', 0)),
('zenoss', ('C:\salt\bin\lib\site-packages\salt-3001rc1_16_ge92daf88a2-py3.7.egg\salt\modules\zenoss.py',
'.py', 0)), ('zfs',
('C:\salt\bin\lib\site-packages\salt-3001rc1_16_ge92daf88a2-py3.7.egg\salt\modules\zfs.py', '.py', 0)),
('zk_concurrency',
('C:\salt\bin\lib\site-packages\salt-3001rc1_16_ge92daf88a2-py3.7.egg\salt\modules\zk_concurrency.py', '.py',
0)), ('znc', ('C:\salt\bin\lib\site-packages\salt-3001rc1_16_ge92daf88a2-py3.7.egg\salt\modules\znc.py',
'.py', 0)), ('zoneadm',
('C:\salt\bin\lib\site-packages\salt-3001rc1_16_ge92daf88a2-py3.7.egg\salt\modules\zoneadm.py', '.py', 0)),
('zonecfg', ('C:\salt\bin\lib\site-packages\salt-3001rc1_16_ge92daf88a2-py3.7.egg\salt\modules\zonecfg.py',
'.py', 0)), ('zookeeper',
('C:\salt\bin\lib\site-packages\salt-3001rc1_16_ge92daf88a2-py3.7.egg\salt\modules\zookeeper.py', '.py', 0)),
('zpool', ('C:\salt\bin\lib\site-packages\salt-3001rc1_16_ge92daf88a2-py3.7.egg\salt\modules\zpool.py', '.py',
0)), ('zypperpkg',
('C:\salt\bin\lib\site-packages\salt-3001rc1_16_ge92daf88a2-py3.7.egg\salt\modules\zypperpkg.py', '.py', 0))])

Then
Wait for output:
[DEBUG ] LazyLoaded file.remove
[DEBUG ] Minion return retry timer set to 8 seconds (randomized)
[INFO ] Returning information for job: 20201029065913992650
[DEBUG ] Initializing new AsyncZeroMQReqChannel for ('c:\salt\conf\pki\minion', 'DESKTOP-PQ3CI8L-43',
'tcp://mywanip:4506', 'aes')
[DEBUG ] Initializing new AsyncAuth for ('c:\salt\conf\pki\minion', 'DESKTOP-PQ3CI8L-43',
'tcp://mywanip:4506')
[DEBUG ] Connecting the Minion to the Master URI (for the return server): tcp://mywanip:4506
[DEBUG ] Trying to connect to: tcp://mywanip:4506
[DEBUG ] Closing AsyncZeroMQReqChannel instance
[DEBUG ] minion return: {'success': True, 'return': {'pid': 13100, 'retcode': 0, 'stdout': 'Starting ScreenConnect
Client (12992950a8ccf0a6)', 'stderr': "Start-Service : Service 'ScreenConnect Client (12992950a8ccf0a6) (ScreenConnect
Client (12992950a8ccf0a6))' cannot be \r\nstarted due to the following error: Cannot start service ScreenConnect
Client (12992950a8ccf0a6) on computer '.'.\r\nAt
C:\Users\administrator\AppData\Local\Temp\__salt.tmp.kr9cpflf.ps1:28 char:9\r\n+ Start-Service
$serviceName\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : OpenError:
(System.ServiceProcess.ServiceController:ServiceController) [Start-Service], \r\n ServiceCommandException\r\n +
FullyQualifiedErrorId : CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand"}, 'retcode': 0, 'jid':
'20201029065913992650', 'fun': 'win_agent.run_script', 'fun_args': [{'filepath':
'salt://scripts//userdefined//ScreenConnectAIO.ps1', 'filename': 'ScreenConnectAIO.ps1', 'shell': 'powershell',
'timeout': 30, 'args': []}]}
[DEBUG ] Subprocess ProcessPayload-Job-20201029065913992650 cleaned up

vs Fire and Forget
[DEBUG ] LazyLoaded file.remove
[DEBUG ] Minion return retry timer set to 6 seconds (randomized)
[INFO ] Returning information for job: 20201029065711285464
[DEBUG ] Initializing new AsyncZeroMQReqChannel for ('c:\salt\conf\pki\minion', 'DESKTOP-PQ3CI8L-43',
'tcp://mywanip:4506', 'aes')
[DEBUG ] Initializing new AsyncAuth for ('c:\salt\conf\pki\minion', 'DESKTOP-PQ3CI8L-43',
'tcp://mywanip:4506')
[DEBUG ] Connecting the Minion to the Master URI (for the return server): tcp://mywanip:4506
[DEBUG ] Trying to connect to: tcp://mywanip:4506
[DEBUG ] Closing AsyncZeroMQReqChannel instance
[DEBUG ] minion return: {'success': True, 'return': {'pid': 24440, 'retcode': None, 'stdout': '', 'stderr': ''},
'retcode': 0, 'jid': '20201029065711285464', 'fun': 'win_agent.run_script', 'fun_args': [{'filepath':
'salt://scripts//userdefined//ScreenConnectAIO.ps1', 'filename': 'ScreenConnectAIO.ps1', 'shell': 'powershell',
'timeout': 30, 'args': [], 'bg': True}]}
C:\Users\ADMINI1\AppData\Local\Temp__salt.tmp.ak05vblk.ps1 : The term
'C:\Users\ADMINI
1\AppData\Local\Temp__salt.tmp.ak05vblk.ps1' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:1

  • C:\Users\ADMINI~1\AppData\Local\Temp__salt.tmp.ak05vblk.ps1
  •   + CategoryInfo          : ObjectNotFound: (C:\Users\ADMINI...mp.ak05vblk.ps1:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

[DEBUG ] Subprocess ProcessPayload-Job-20201029065711285464 cleaned up

<!-- gh-comment-id:718405250 --> @bradhawkins85 commented on GitHub (Oct 29, 2020): Looks like the command is getting to the agent. Both methods bombard me with the following: ('C:\\salt\\bin\\lib\\site-packages\\salt-3001rc1_16_ge92daf88a2-py3.7.egg\\salt\\modules\\zcbuildout.py', '.py', 0)), ('zenoss', ('C:\\salt\\bin\\lib\\site-packages\\salt-3001rc1_16_ge92daf88a2-py3.7.egg\\salt\\modules\\zenoss.py', '.py', 0)), ('zfs', ('C:\\salt\\bin\\lib\\site-packages\\salt-3001rc1_16_ge92daf88a2-py3.7.egg\\salt\\modules\\zfs.py', '.py', 0)), ('zk_concurrency', ('C:\\salt\\bin\\lib\\site-packages\\salt-3001rc1_16_ge92daf88a2-py3.7.egg\\salt\\modules\\zk_concurrency.py', '.py', 0)), ('znc', ('C:\\salt\\bin\\lib\\site-packages\\salt-3001rc1_16_ge92daf88a2-py3.7.egg\\salt\\modules\\znc.py', '.py', 0)), ('zoneadm', ('C:\\salt\\bin\\lib\\site-packages\\salt-3001rc1_16_ge92daf88a2-py3.7.egg\\salt\\modules\\zoneadm.py', '.py', 0)), ('zonecfg', ('C:\\salt\\bin\\lib\\site-packages\\salt-3001rc1_16_ge92daf88a2-py3.7.egg\\salt\\modules\\zonecfg.py', '.py', 0)), ('zookeeper', ('C:\\salt\\bin\\lib\\site-packages\\salt-3001rc1_16_ge92daf88a2-py3.7.egg\\salt\\modules\\zookeeper.py', '.py', 0)), ('zpool', ('C:\\salt\\bin\\lib\\site-packages\\salt-3001rc1_16_ge92daf88a2-py3.7.egg\\salt\\modules\\zpool.py', '.py', 0)), ('zypperpkg', ('C:\\salt\\bin\\lib\\site-packages\\salt-3001rc1_16_ge92daf88a2-py3.7.egg\\salt\\modules\\zypperpkg.py', '.py', 0))]) Then Wait for output: [DEBUG ] LazyLoaded file.remove [DEBUG ] Minion return retry timer set to 8 seconds (randomized) [INFO ] Returning information for job: 20201029065913992650 [DEBUG ] Initializing new AsyncZeroMQReqChannel for ('c:\\salt\\conf\\pki\\minion', 'DESKTOP-PQ3CI8L-43', 'tcp://mywanip:4506', 'aes') [DEBUG ] Initializing new AsyncAuth for ('c:\\salt\\conf\\pki\\minion', 'DESKTOP-PQ3CI8L-43', 'tcp://mywanip:4506') [DEBUG ] Connecting the Minion to the Master URI (for the return server): tcp://mywanip:4506 [DEBUG ] Trying to connect to: tcp://mywanip:4506 [DEBUG ] Closing AsyncZeroMQReqChannel instance [DEBUG ] minion return: {'success': True, 'return': {'pid': 13100, 'retcode': 0, 'stdout': 'Starting ScreenConnect Client (12992950a8ccf0a6)', 'stderr': "Start-Service : Service 'ScreenConnect Client (12992950a8ccf0a6) (ScreenConnect Client (12992950a8ccf0a6))' cannot be \r\nstarted due to the following error: Cannot start service ScreenConnect Client (12992950a8ccf0a6) on computer '.'.\r\nAt C:\\Users\\administrator\\AppData\\Local\\Temp\\__salt.tmp.kr9cpflf.ps1:28 char:9\r\n+ Start-Service $serviceName\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], \r\n ServiceCommandException\r\n + FullyQualifiedErrorId : CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand"}, 'retcode': 0, 'jid': '20201029065913992650', 'fun': 'win_agent.run_script', 'fun_args': [{'filepath': 'salt://scripts//userdefined//ScreenConnectAIO.ps1', 'filename': 'ScreenConnectAIO.ps1', 'shell': 'powershell', 'timeout': 30, 'args': []}]} [DEBUG ] Subprocess ProcessPayload-Job-20201029065913992650 cleaned up vs Fire and Forget [DEBUG ] LazyLoaded file.remove [DEBUG ] Minion return retry timer set to 6 seconds (randomized) [INFO ] Returning information for job: 20201029065711285464 [DEBUG ] Initializing new AsyncZeroMQReqChannel for ('c:\\salt\\conf\\pki\\minion', 'DESKTOP-PQ3CI8L-43', 'tcp://mywanip:4506', 'aes') [DEBUG ] Initializing new AsyncAuth for ('c:\\salt\\conf\\pki\\minion', 'DESKTOP-PQ3CI8L-43', 'tcp://mywanip:4506') [DEBUG ] Connecting the Minion to the Master URI (for the return server): tcp://mywanip:4506 [DEBUG ] Trying to connect to: tcp://mywanip:4506 [DEBUG ] Closing AsyncZeroMQReqChannel instance [DEBUG ] minion return: {'success': True, 'return': {'pid': 24440, 'retcode': None, 'stdout': '', 'stderr': ''}, 'retcode': 0, 'jid': '20201029065711285464', 'fun': 'win_agent.run_script', 'fun_args': [{'filepath': 'salt://scripts//userdefined//ScreenConnectAIO.ps1', 'filename': 'ScreenConnectAIO.ps1', 'shell': 'powershell', 'timeout': 30, 'args': [], 'bg': True}]} C:\Users\ADMINI~1\AppData\Local\Temp\__salt.tmp.ak05vblk.ps1 : The term 'C:\Users\ADMINI~1\AppData\Local\Temp\__salt.tmp.ak05vblk.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + C:\Users\ADMINI~1\AppData\Local\Temp\__salt.tmp.ak05vblk.ps1 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\Users\ADMINI...mp.ak05vblk.ps1:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException [DEBUG ] Subprocess ProcessPayload-Job-20201029065711285464 cleaned up
Author
Owner

@bradhawkins85 commented on GitHub (Oct 29, 2020):

The first thing that jumps out at me is the Wait for output file path is \ where the Fire and forget is only single \

<!-- gh-comment-id:718405783 --> @bradhawkins85 commented on GitHub (Oct 29, 2020): The first thing that jumps out at me is the Wait for output file path is \\ where the Fire and forget is only single \
Author
Owner

@wh1te909 commented on GitHub (Oct 29, 2020):

ok i was able to reproduce, I was just using python scripts originally to test, not batch or powershell
so clearly a bug with salt, passing bg=True to salt's cmd.script module messes up the filepath
I would open a ticket with salt but not worth it since i already have this implemented in the go agent so will be moving to that shortly.

I worked around the salt bug for now in 8d33b4b099 so please update and should work

<!-- gh-comment-id:718457667 --> @wh1te909 commented on GitHub (Oct 29, 2020): ok i was able to reproduce, I was just using python scripts originally to test, not batch or powershell so clearly a bug with salt, passing bg=True to salt's cmd.script module messes up the filepath I would open a ticket with salt but not worth it since i already have this implemented in the go agent so will be moving to that shortly. I worked around the salt bug for now in 8d33b4b09928970df50cdd2145766d82c04f6745 so please update and should work
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tacticalrmm#89
No description provided.