Invoke-AutomateAPIMaster : An error has been thrown.
BrambleTheBoar opened this issue · 2 comments
Sorry for the duplicate issue, but I'm having the same problem as Issue #67 . I'm running the powershell commands from a workstation, not my Automate server if that helps. Full log from powershell:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Windows\system32> Import-Module AutomateAPI
PS C:\Windows\system32> Connect-AutomateAPI
Please enter your Automate Server address, IE: rancor.hostedrmm.com: https://
Please enter API Client ID (Required for 2020.P11 and above):
Please enter your Automate Username:
Please enter your Automate Password:
Please enter your 2FA Token:
Successfully tested and connected to the Automate REST API. Token will expire at 2022-01-07T20:16:34
PS C:\Windows\system32> Connect-ControlAPI
Please enter your Control Server address, the full URL. IE https://control.rancorthebeast.com:8040: http://:8040
Please enter your Control Username:
Please enter your Control Password:
Control Extension version 4.3.0.2 enabled: True
Server version is 21.13.5058.7951.
Successfully tested and connected to the Control API.
PS C:\Windows\system32> Get-AutomateComputer -ComputerID 2
Invoke-AutomateAPIMaster : An error has been thrown.
at Invoke-AutomateAPIMaster, C:\Program
Files\WindowsPowerShell\Modules\AutomateAPI\1.1.5\Private\Invoke-AutomateAPIMaster.ps1: line 75
at Get-AutomateAPIGeneric, C:\Program
Files\WindowsPowerShell\Modules\AutomateAPI\1.1.5\Public\Get-AutomateAPIGeneric.ps1: line 146
at Get-AutomateComputer, C:\Program Files\WindowsPowerShell\Modules\AutomateAPI\1.1.5\Public\Get-AutomateComputer.ps1:
line 413
at , : line 1
-->
-->
At C:\Program Files\WindowsPowerShell\Modules\AutomateAPI\1.1.5\Public\Get-AutomateAPIGeneric.ps1:146 char:27
- ... $Result = Invoke-AutomateAPIMaster -Arguments $Arguments
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
- FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-AutomateAPIMaster
PS C:\Windows\system32>
If this needs to be run directly on the Automate server, I'm waiting for a maintenance window to restart the server after upgrading powershell from v4. The Powershell version was too low to run Install-Module commands. We also self-host and are using control plugin, not a separate control server if that matters at all.
The initial error from Invoke-AutomateAPIMaster.ps1 is getting hung up on line 75: $Result = Invoke-WebRequest @arguments
I'm not entirely sure what all goes into the @arguments field. Some direction there might help troubleshoot why it's throwing an error.
Does the api require both the Automate server and control server to both be on https? My setup is still using HTTP for the control server.
Disregard, you can close this Issue. If anyone finds this in the future, you get this error with an invalid API key.