I experimented with the Script related Commands a bit and based on my findings, I am NOT able to find any evidence that the Author implemented the “/system/script/run” Command, into the MikroTik PowerShell Module.
I created a Script, named simply “test” (which was allocated the “id” of “*e”), which writes the word “Test” to the MikroTik Log, specifically for Testing.
From the MikroTik CLI, I had no problem running the following Commands, nor did I have any problems running their PowerShell equivalents.
MiktoTik CLI Command (Name):
:put [system script get test]
PowerShell Equivalent (Name):
Send-Mikrotik -Connection $C -Command "/system/script/getall" -Filters "name=test"
MiktoTik CLI Command (ID):
:put [system script get *e]
PowerShell Equivalent (ID):
Send-Mikrotik -Connection $C -Command "/system/script/getall" -Filters ".id=*E"
Output from MikroTik CLI & PowerShell Equivalent:
.id=*E=name=test=owner=admin11=policy=reboot,read,write,test,sniff,sensitive=last-started=jul/08/2023 13:50:36=run-count=2=source=log info test=invalid=false
When it came to Running the Script, I had No issues, when Running the following Commands from the MikroTik CLI.
MiktoTik CLI Command (Name):
system script run test
MiktoTik CLI Command (ID):
system script run *e
Unfortunately, the PowerShell Equivalents did Not work, at all.
PowerShell Equivalent (Name):
Send-Mikrotik -Connection $C -Command "/system/script/run" -Filters "name=test"
PowerShell Equivalent (ID):
Send-Mikrotik -Connection $C -Command "/system/script/run" -Filters ".id=*E"
Output from PowerShell Equivalent:
script not found
I tried several variations of the two PowerShell Scripts above, but each and every time, the “Script not found” message was returned.
On a positive note, I was able to find a couple Discussions, that do a decent job of explaining how calls are made to via MikroTik API, in relation to Running Scripts, etc.
Run scripts from API:
http://forum.mikrotik.com/t/run-scripts-from-api/47753/1
Running a script from API:
http://forum.mikrotik.com/t/running-a-script-from-api/36649/1
That being said, I plan on going through the Source Code for the MikroTik PowerShell Module, to determine whether the “/system/script/run” Command has been Implemented and if Not, I’ll do what I can, to implement it, myself.