Skip to main content

Get-CWControlAgentSession

Description

This method connects to ConnectWise Control via the built-in Plugin API in Automate to obtain a list of computers with their last check-in date and current state.

Requirements

  • ConnectWise Control with a properly configured ConnectWise Automate plugin.
  • ConnectWise Automate with a properly configured ConnectWise Control plugin.

Usage

  1. Stores the ConnectWise Control extension ID.
  2. Connects to the Control API with the provided server and token.
  3. Submits the request to the API with the requested included properties.
  4. Returns a system object containing the requested information.

The system object will contain:

  • SessionID
  • OnlineStatusControl
  • LastConnected
  • Name
  • ConnectionCount
.\Get-CWControlAgentSession.ps1 -Server 'https://something.someplace.com/controlportal' -Token 'SomeAPIKEY' -IncludeProperty Name, ConnectionCount

Parameters

ParameterAliasRequiredDefaultTypeDescription
ServerTrueStringThe ConnectWise Control server address.
TokenTrueStringThe API token for ConnectWise Control.
IncludedPropertyFalseString[]A validated set of optional properties to query.
KeyTrueByte[]A pre-script designated key to decrypt sensitive information.

Output

  • .\Get-CWControlAgentSession-log.txt
  • .\Get-CWControlAgentSession-error.txt