You will need to Download the “MikroTik-PS-Module.zip”, located at the bottom of the OP (or simply Click the Link, I left below)
After extracting the ZIP Folder, you should see the resulting “MikroTik-PS-Module” Folder, which should contain the “MikroTik.dll” file, along with a “README.txt” File, containing Instructions, Examples, etc.
If for some reason, you don’t see the “MikroTik.dll” File, in the Extracted Folder, I would check your Anti-Virus, to ensure that it hasn’t Quarantined the File, for some reason or another.
I should also note that Windows 10/11 may block DLL Files that have been Downloaded from the Internet. As a result, you may have to Unblock the File.
To accomplish this task, simply Right-Click on the “MikroTik.dll” File and Select the “Properties” from the Drop-Down/Context Menu.
Once the “Properties” Panel Opens, Select the “General” Tab and if you can see an “Unblock” Checkbox toward the bottom of the Panel, you’ll want to Check the box and Click the “Apply” Button, in the Bottom-Right of the Panel, to Unblock it.
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.
.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.
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.
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.