< Back

Connect-ControlAPI

Sat Jan 11, 2020 2:04 am

NAME Connect-ControlAPI



SYNOPSIS

Adds credentials required to connect to the Control API





SYNTAX

Connect-ControlAPI [-Credential <PSCredential>] [-Server <String>] [-SkipCheck] [-Quiet] [<CommonParameters>]



Connect-ControlAPI [-Server <String>] [-APIKey <Object>] [-SkipCheck] [-Quiet] [<CommonParameters>]



Connect-ControlAPI [-Verify] [-Quiet] [<CommonParameters>]





DESCRIPTION

Creates a Control hashtable in memory containing the server and username/password so that it can be used in other

functions that connect to ConnectWise Control. Unfortunately the Control API does not support 2FA.





PARAMETERS

-Credential <PSCredential>

Takes a standard powershell credential object, this can be built with $CredentialsToPass = Get-Credential,

then pass $CredentialsToPass



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Server <String>

The address to your Control Server. Example 'https://control.rancorthebeast.com:8040'



Required? false

Position? named

Default value $Script:ControlServer

Accept pipeline input? false

Accept wildcard characters? false



-APIKey <Object>

Automate APIKey for Control Extension



Required? false

Position? named

Default value ([SecureString]$Script:ControlAPIKey)

Accept pipeline input? false

Accept wildcard characters? false



-Verify [<SwitchParameter>]

Attempt to verify Cached API key or Credentials. Invalid results will be removed.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-SkipCheck [<SwitchParameter>]

Used to set Server URL and Credentials without testing.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Quiet [<SwitchParameter>]

Will not output any standard logging messages. Function will returns True or False.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

Sets script variables with Server URL and Credentials or ApiKey.





NOTES





Version: 1.0

Author: Gavin Stone

Creation Date: 20/01/2019

Purpose/Change: Initial script development



Version: 1.1

Author: Gavin Stone

Creation Date: 22/06/2019

Purpose/Change: The previous function was far too complex. No-one could debug it and a lot of it was

unnecessary. I have greatly simplified it.



Version: 1.2

Author: Darren White

Creation Date: 2019-06-24

Purpose/Change: Added support for APIKey authentication. The new function was not complex enough.



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>All values will be prompted for one by one:



Connect-ControlAPI

All values needed to Automatically create appropriate output

Connect-ControlAPI -Server "https://control.rancorthebeast.com:8040" -Credentials $CredentialsToPass











RELATED LINKS