Open McDBAOptPHC opened 2 months ago
Hi @McDBAOptPHC ,
It seems like the default parameter value List
is no longer working.
While we fix this, please use Get-RSCMssqlDatabase -List
and Get-RscMssqlInstance -List
.
Thanks
That does work. However, we are also having issues passing instance values to the cmdlet. I confirmed that the instance cmdlet is returning a value.
Get-RSCMssqlDatabase -RscMssqlInstance $(Get-RSCMssqlInstance -HostName "MYHOST" -InstanceName "MYINSTANCE")[0]
InvalidOperation: C:\Program Files\PowerShell\Modules\RubrikSecurityCloud\1.3\Toolkit\Public\Get-RscMssqlDatabase.ps1:100:9
Line |
100 | $results = $query.Invoke()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
| Method invocation failed because [System.String] does not contain a method named 'Invoke'.
Fix in PR #97
@McDBAOptPHC We'll be releasing a fix shortly. In the meantime, you'll want to use the RscMssqlInstance
parameter in combination with List
to avoid the issue.
Something like
Get-RSCMssqlDatabase -List -RscMssqlInstance
@McDBAOptPHC Apologies, I previously mispoke.
Please use the following parameter set
Get-RSCMssqlDatabase -Name $name -RscMssqlInstance $instance
I tried that I get the following error. (The passed variable is set using Get-RSCMSSQLInstance.
Get-RSCMSSQLDatabase -Name 'Master' -RscMssqlInstance $TestInstance
Get-RscMssqlDatabase: Cannot process argument transformation on parameter 'RscMssqlInstance'. Cannot convert the "System.Object[]" value of type "System.Object[]" to type "RubrikSecurityCloud.Types.MssqlInstance".
It looks like the return type from the Get-MSCSQlInstance may be an issue. I tried manually typing my variable for that cmdlet and ended up with the same error:
[RubrikSecurityCloud.Types.MssqlInstance]$TestInstance = Get-RSCMssqlInstance -HostName $TestHost.Name -InstanceName My_Instance
MetadataError: Cannot convert the "System.Object[]" value of type "System.Object[]" to type "RubrikSecurityCloud.Types.MssqlInstance".
Digging in a little bit it looks like it's returning two instances in the results but both objects in the array are identical both [0] and [1] have identical IDs. When I call either of those in the command it works as expected:
Get-RSCMSSQLDatabase -Name 'Master' -RscMssqlInstance $TestInstance[1]
However is there a way to get it to return all of the databases connected to an instance? Just for completeness, I wanted to update this with what I get when I try and just output an instance to the cmdlet
Get-RSCMSSQLDatabase -RscMssqlInstance $TestInstance[0]
InvalidOperation: C:\Program Files\PowerShell\Modules\RubrikSecurityCloud\1.3\Toolkit\Public\Get-RscMssqlDatabase.ps1:100:9
Line |
100 | $results = $query.Invoke()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.
PS D:\rubrik> Get-RSCMSSQLDatabase -RscMssqlInstance $TestInstance[1]
InvalidOperation: C:\Program Files\PowerShell\Modules\RubrikSecurityCloud\1.3\Toolkit\Public\Get-RscMssqlDatabase.ps1:100:9
Line |
100 | $results = $query.Invoke()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.
Any attempt to run the cmdlet is returning this error.
I have verified that the problem happens with or without parameters:
We are on 1.3 I updated just after seeing the issue.
Let me know if there are any other info that you need to dig in on this.