Thanks for replying. I debugged the script as you suggested and there are several "401 Authorization failed" errors in the output. Below is a sample:
{"datetime":"2020-07-16 09:52:06","severity":"SUCCESS","message":"Successfully loaded the config file: bigipreportconfig.xml"}
{"datetime":"2020-07-16 09:52:06","severity":"VERBOSE","message":"Starting: PSCommandPath=C:\\inetpub\\bigipreport\\bigipreport.ps1 ConfigurationFile=bigipreportconfig.xml PollLoadBalancer=<device_name_redacted> Location= PSScriptRoot=C:\\inetpub\\bigipreport"}
{"datetime":"2020-07-16 09:52:06","severity":"VERBOSE","message":"Pre-execution checks"}
{"datetime":"2020-07-16 09:52:06","severity":"SUCCESS","message":"Pre execution checks were successful"}
{"datetime":"2020-07-16 09:52:06","severity":"VERBOSE","message":"Enabling TLS1.2"}
{"datetime":"2020-07-16 09:52:06","severity":"VERBOSE","message":"Getting data from <device_name_redacted>"}
Invoke-RestMethod : {"code":401,"message":"Authorization failed: user=https://localhost/mgmt/cm/system/authn/providers/tmos/1f44a60e-11a7-3c51-a49f-82983026b41b/users/3a0d0d04-e904-37f6-9117-726f51919714 resource=/mgmt/tm/sys/global-settings verb=GET uri:http://localhost:8100/mgmt/tm/sys/global-settings referrer:10.4.16.20 sender:10.4.16.20","referer":"10.4.16.20","restOperationId":2944442,"kind":":resterrorresponse"}
At C:\inetpub\bigipreport\bigipreport.ps1:1622 char:17
+ ... $Response = Invoke-RestMethod -SkipCertificateCheck -Headers $Headers ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Method: GET, Reques\u2026PowerShell/6.2.3
}:HttpRequestMessage) [Invoke-RestMethod], HttpResponseException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
The property 'hostname' cannot be found on this object. Verify that the property exists.
At C:\inetpub\bigipreport\bigipreport.ps1:1623 char:5
+ $BigIPHostname = $Response.hostname
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], PropertyNotFoundException
+ FullyQualifiedErrorId : PropertyNotFoundStrict
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)