LabtechConsulting / ConnectWise-Manage-Powershell

This is a PowerShell wrapper for the ConnectWise Manage REST API.
http://labtechconsulting.com
34 stars 19 forks source link

Connect-CWM ClientID #5

Open jgshier opened 5 years ago

jgshier commented 5 years ago

Will you be adding an option for ClientID? https://developer.connectwise.com/ClientID

TheSystech commented 5 years ago

Ooops I duplicated this one as an issue because I didn't see yours. FYI, if they don't get it in time it's pretty easy to do yourself as a temp fix. I simply modified the Connect-CWM function at the very top of CWManage.psm1

Here's a quick Git Diff of the original file with my changes.

@@ -43,6 +43,9 @@ function Connect-CWM {
         .PARAMETER DontWarn
         Used to suppress the warning about integrator accounts.

+        .PARAMETER ClientID
+        Used to pass ClientID variable required in CWM 2019.3
+
         .EXAMPLE
         $Connection = @{
             Server = $Server
@@ -100,7 +103,9 @@ function Connect-CWM {
         [string]$IntegratorPass,
         [string]$MemberID,
         [switch]$Force,
-        [switch]$DontWarn
+        [switch]$DontWarn,
+        [string]$ClientID
+
     )

     # Version supported
@@ -201,7 +206,10 @@ function Connect-CWM {
         Write-Error "Valid authentication parameters not passed"
         return
     }
-
+    if ($ClientID)
+    {
+        $Headers.Add("ClientID", $ClientID)
+    }
     # Create the Server Connection object
     $global:CWMServerConnection = @{
         Server = $Server
TheSystech commented 5 years ago

Or, even easier now that I've taken the time to figure out how, I Forked the project for now and added the necessary code to my Fork. That's the only change so once they add in code for that to the main branch my fork will become redundant.