christaylorcodes / ConnectWiseControlAPI

PowerShell wrapper for ConnectWise Control
MIT License
69 stars 36 forks source link

Add maxlength to Invoke-CWCCommand #16

Closed jmanning16 closed 1 year ago

jmanning16 commented 1 year ago

Use a clear and descriptive title for the issue to identify the suggestion.

Add a param to the Invoke-CWCCommand as well as then add to $FormattedCommand array for the webrequest.

Current:

param (
        [Parameter(Mandatory = $True)]
        [guid]$GUID,
        [string]$Command,
        [int]$TimeOut = 10000,
        [switch]$PowerShell,
        [string]$Group = 'All Machines',
        [switch]$NoWait
    )
---
    $FormattedCommand = @()
    if ($Powershell) { $FormattedCommand += '#!ps' }
    $FormattedCommand += "#timeout=$TimeOut"
    $FormattedCommand += $Command
    $FormattedCommand = $FormattedCommand | Out-String

With maxlength:

param (
        [Parameter(Mandatory = $True)]
        [guid]$GUID,
        [string]$Command,
        [int]$TimeOut = 10000,
        [int]$maxlength = 10000,
        [switch]$PowerShell,
        [string]$Group = 'All Machines',
        [switch]$NoWait
    )
---
    $FormattedCommand = @()
    if ($Powershell) { $FormattedCommand += '#!ps' }
    $FormattedCommand += "#timeout=$TimeOut"
    $FormattedCommand += "#maxlength=$maxlength"
    $FormattedCommand += $Command
    $FormattedCommand = $FormattedCommand | Out-String

This will increase the amount of text output that is allowed for the commands run against control sessions.

christaylorcodes commented 1 year ago

Added 0.3.4.0