Screenconnect commandline: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
==CLI Notes== | ==CLI Notes== | ||
===Running Commands=== | |||
There exist a few ways to issue CLI commands in ScreenConnect / Connectwise Control. | There exist a few ways to issue CLI commands in ScreenConnect / Connectwise Control. | ||
* Right-Clicking on a session and choosing 'Run Command' | * Right-Clicking on a session and choosing 'Run Command' | ||
Line 7: | Line 8: | ||
* #!ps | * #!ps | ||
* powershell | * powershell | ||
===Timeouts=== | |||
Commands may time out if running for too long. The default time-out value can be overridden by using | Commands may time out if running for too long. The default time-out value can be overridden by using | ||
<pre># | <pre>#timout=90000</pre> replacing 90000 with the desired interval. | ||
===Truncated Output=== | |||
The output from a command may be truncated, but can be extended by overriding the default using | |||
<pre>#maxlength=1000000</pre> replacing 1000000 with desired output length. | |||
===Example of Pre-Pended Options=== | |||
<syntaxhighlight lang="powershell" line='line'> | |||
#!ps | |||
#timeout=90000 | |||
Get-Process sam* | Select-object name | |||
</syntaxhighlight> | |||
==Enable Remote Execution== | ==Enable Remote Execution== |
Revision as of 20:35, 13 March 2020
CLI Notes
Running Commands
There exist a few ways to issue CLI commands in ScreenConnect / Connectwise Control.
- Right-Clicking on a session and choosing 'Run Command'
- Clicking on the 'Commands' icon in the right-hand panel
- Right-Clicking on a session, selecting 'Join With Options' and then selecting 'Backstage'
Normal (CMD) style commands do not require anything other than the command itself to be issued. Powershell commands require being prefaced with one of the two listed examples:
- #!ps
- powershell
Timeouts
Commands may time out if running for too long. The default time-out value can be overridden by using
#timout=90000
replacing 90000 with the desired interval.
Truncated Output
The output from a command may be truncated, but can be extended by overriding the default using
#maxlength=1000000
replacing 1000000 with desired output length.
Example of Pre-Pended Options
#!ps
#timeout=90000
Get-Process sam* | Select-object name
Enable Remote Execution
Set-ExecutionPolicy RemoteSigned
Show Processes Names Like X
Get-Process sam* | Select-object name
Test if Service is Running
(Get-Service -Name 'Spooler').Status -eq 'Running'
Show Drives and Space Usage
get-psdrive -psprovider filesystem
Create a Desktop shortcut to a folder
$TargetFile = "C:\scan\"
$ShortcutFile = "$env:Public\Desktop\folder.lnk"
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
$Shortcut.TargetPath = $TargetFile
$Shortcut.Save()