rubrikinc / rubrik-sdk-for-powershell

Rubrik Module for PowerShell
https://build.rubrik.com/sdks/powershell/
MIT License
102 stars 87 forks source link

get-rubrikdatabase works in "powershell ISE", but is delayed in "powershell.exe" #831

Open Gdvl opened 1 year ago

Gdvl commented 1 year ago

Current Behavior

I can connect to Rubrik without any problems in both "powershell ISE" as in the normal "powershell"
When I run Get-RubrikDatabase in "powershell ISE" it works fine (a little slowy, but it works)
When I run it within powershell.exe (or from cmd as powershell.exe -file "....", the command hangs for 10-15 minutes without any error. (after a successfull connect ...)
When I use the -verbose parameter, it paused after "Received HTTP Status 200" for 10-15 mins (sometimes more)

PS C:\Windows\system32> Get-RubrikDatabase -Verbose
VERBOSE: Validate the Rubrik token exists
VERBOSE: Found a Rubrik token for authentication
VERBOSE: Gather API Data for Get-RubrikDatabase
VERBOSE: Selected 1.0 API Data for Get-RubrikDatabase
VERBOSE: Load API data for Get-RubrikDatabase
VERBOSE: Description: Returns a list of summary information for Microsoft SQL databases.
VERBOSE: Build the URI
VERBOSE: URI = https://rubrikgza.gvagroup.local/api/v1/mssql/db
VERBOSE: Build the query parameters for availability_group_id,instance_id,primary_cluster_id,effective_sla_domain_id
VERBOSE: URI = https://rubrikgza.gvagroup.local/api/v1/mssql/db
VERBOSE: Submitting the request
VERBOSE: Invoking request with a custom timeout of 100 seconds
VERBOSE: GET https://rubrikgza.gvagroup.local/api/v1/mssql/db with 0-byte payload
VERBOSE: received 2163951-byte response of content type application/json
VERBOSE: Received HTTP Status 200

_PAUSED ..._

VERBOSE: Formatting return value
VERBOSE: Filter the results
VERBOSE: Filter match = 'AvailabilityGroupID' with value = ''
VERBOSE: Filter match = 'Instance' with value = ''
VERBOSE: Filter match = 'Name' with value = ''
VERBOSE: Filter match = 'Hostname' with value = ''
VERBOSE: Filter match = 'SLA' with value = ''
VERBOSE: Applying Rubrik.MSSQLDatabase TypeName to results```

### Expected Behavior

PS C:\Windows\system32> get-rubrikdatabase -Verbose
VERBOSE: Validate the Rubrik token exists
VERBOSE: Found a Rubrik token for authentication
VERBOSE: Gather API Data for Get-RubrikDatabase
VERBOSE: Selected 1.0 API Data for Get-RubrikDatabase
VERBOSE: Load API data for Get-RubrikDatabase
VERBOSE: Description: Returns a list of summary information for Microsoft SQL databases.
VERBOSE: Build the URI
VERBOSE: URI = https://rubrikgza.gvagroup.local/api/v1/mssql/db
VERBOSE: Build the query parameters for availability_group_id,instance_id,primary_cluster_id,effective_sla_domain_id
VERBOSE: URI = https://rubrikgza.gvagroup.local/api/v1/mssql/db
VERBOSE: Submitting the request
VERBOSE: Invoking request with a custom timeout of 100 seconds
VERBOSE: GET https://rubrikgza.gvagroup.local/api/v1/mssql/db with 0-byte payload
VERBOSE: received 2163951-byte response of content type application/json
VERBOSE: Received HTTP Status 200
VERBOSE: Formatting return value
VERBOSE: Filter the results
VERBOSE: Filter match = 'AvailabilityGroupID' with value = ''
VERBOSE: Filter match = 'Instance' with value = ''
VERBOSE: Filter match = 'Name' with value = ''
VERBOSE: Filter match = 'Hostname' with value = ''
VERBOSE: Filter match = 'SLA' with value = ''
VERBOSE: Applying Rubrik.MSSQLDatabase TypeName to results

After this, I see all my Rubrik db's.

### Steps to Reproduce

Measure results within ISE:
![image](https://user-images.githubusercontent.com/129399265/229121675-d5b87113-f80b-4717-9d62-4398a10b64e9.png)

Measure result within powershell.exe:
![image](https://user-images.githubusercontent.com/129399265/229122220-4e245cdc-3706-4640-a793-61519ea52edf.png)

Both executed on the same machine, with the same credentials.

### Context

```PowerShell
PS C:\Windows\system32> Get-RubrikDebugInfo

PSVersion                     : 5.1.17763.3770
PSEdition                     : Desktop
PSCompatibleVersions          : {1.0, 2.0, 3.0, 4.0...}
BuildVersion                  : 10.0.17763.3770
CLRVersion                    : 4.0.30319.42000
WSManStackVersion             : 3.0
PSRemotingProtocolVersion     : 2.3
SerializationVersion          : 1.1.0.1
HostConsoleName               : ConsoleHost
HostConsoleVersion            : 5.1.17763.3770
HostCulture                   : nl-BE
HostCultureUI                 : en-US
RubrikConnection              : True
UserAgentString               : RubrikPowerShellSDK-6.0.1--5.1.17763.3770--platform--Win32NT--platform_version--Microso
                                ft Windows Server 2019 Standard17763
RubrikAuthentication          : Bearer
RubrikClusterVersion          : 6.0.3-p7-13679
RubrikCurrentModuleVersion    : 6.0.1
RubrikInstalledModule         : 6.0.1
RubrikModuleOptions           : ApplyCustomViewDefinitions = True; CredentialPath = ; DefaultWebRequestTimeOut = 100
RubrikModuleDefaultParameters :

Failure Logs

No response