I posted this in another thread and someone suggested I make a separate topic. So here it is!
Below applies to ScreenConenct "Cloud" hosted version (should be the same for self hosted version).
If you are using ScreenConenct and needs to run command-line using either windows CMD or PowerShell commands that are multi-lines or take more than a second or two to finish. Then try the below:
For Poweshell commands:
Paste below into ScreenConnect cmd windows / tab
#!ps
#maxlength=50000
#timeout=300000
ping 127.0.0.1
dir
etc
Line #1 is to use Powershell (to use plain Windows cmd see below)
Line #2 & #3 are to allow long running commands.
#!cmd
#maxlength=50000
#timeout=300000
dir
etc
You can use this to launch batch files from network share etc.
Below example download and install an app (after activating / installing .Net framework 3) after downloading it from a url.
#!ps
#maxlength=50000
#timeout=300000
DISM /Online /Enable-Feature /FeatureName:NetFx3
Start-Sleep -s 120
$url = "http://<url to executable goes here>"
$filename = "<name to give to downloaded executable/file>.exe"
$client = New-Object System.Net.WebClient
$client.DownloadFile($url, "$env:temp$filename")
Start-Process -FilePath "$env:temp$filename" <some argument to the executablegoes here>"
Using the above you can do quite a lot! Something along a poor man's RMM.
Some usage scenarios:
- Mass roll out software (tick relevant hosts then past cmd into cmd prompt windows)
- Trigger specific taks
- Antying that can be made to run silently via cmd line
Keep in mind that the cmd line context (that all the cmd will run under) is by default the <WINDIR>\systems32. So you will need to issue CD to change into the directory you want before running the cmd.
Everything runs under the [ScreenConnect] service account with Full rights to the OS.
I will post about implementing ACL (user access control) via Custom fields so it is possible to restrict users / tech to specific hosts in a manageable manner. I will post more when I get a bit more time.