rubrikinc / rubrik-powershell-sdk

The Rubrik Security Cloud SDK
https://www.powershellgallery.com/packages/RubrikSecurityCloud
MIT License
7 stars 9 forks source link

Get-RscMssqlInstance -List returning invalid object types #78

Closed McDBAOptPHC closed 3 months ago

McDBAOptPHC commented 3 months ago

We are unable to run Get-RscMssqlInstance with any of the parameters which looks to already be a reported issue, but if I run it with the -List switch I am not getting back any of the enrolled instances, instead I am getting host and cluster objects: (Get-RscMssqlInstance -List).objectType Output: WINDOWS_CLUSTER PHYSICAL_HOST PHYSICAL_HOST PHYSICAL_HOST PHYSICAL_HOST PHYSICAL_HOST WINDOWS_CLUSTER PHYSICAL_HOST PHYSICAL_HOST WINDOWS_CLUSTER PHYSICAL_HOST PHYSICAL_HOST PHYSICAL_HOST WINDOWS_CLUSTER PHYSICAL_HOST PHYSICAL_HOST PHYSICAL_HOST PHYSICAL_HOST PHYSICAL_HOST WINDOWS_CLUSTER PHYSICAL_HOST

clumnah commented 3 months ago

Hello, I believe this is a different issue than the one we spoke about over email, correct?

The above output is correct and by design. Take a look at the below output.

AuthorizedOperations        : 
ObjectType                  : PHYSICAL_HOST
OsType                      : 
SlaAssignment               : UNASSIGNED
ConfiguredSlaDomain         : 
EffectiveRetentionSlaDomain : 
EffectiveSlaDomain          : RubrikSecurityCloud.Types.GlobalSlaReply
PendingSla                  : 
ReplicatedObjects           : 
AgentId                     : {62fb9ac5-79b1-4355-8531-fd61c37d8740}
CbtStatus                   : Enabled
CdmId                       : 0c0fb77d-d959-494d-af5f-bdb0f230c46a
CdmLink                     : 
DefaultCbt                  : 
Id                          : f61620b7-57ed-5368-8407-21a9f8477df2
IpAddresses                 : 
IsArchived                  : False
IsChangelistEnabled         : False
IsOracleHost                : False
Name                        : sh2-qstar-w1
NasMigrationInfo            : 
NasVendorType               : 
NumWorkloadDescendants      : 12
OsName                      : 
ReplicatedObjectCount       : 
SlaPauseStatus              : False
VfdState                    : Installed
AllOrgs                     : 
Cluster                     : 
ConnectionStatus            : 
DescendantConnection        : 
EffectiveSlaSourceObject    : 
HostVolumes                 : 
LatestUserNote              : 
LogicalPath                 : 
OracleUserDetails           : 
PendingObjectDeletionStatus : 
PhysicalChildConnection     : RubrikSecurityCloud.Types.PhysicalHostPhysicalChildTypeConnection
PhysicalPath                : 
PrimaryClusterLocation      : 
SnapshotDistribution        : 

You can easily tell what host this SQL Server is and then instance information itself would be found under the PhysicalChildConnection object. This is because if we only returned back the instance object itself, it would look like the below.

AuthorizedOperations        : 
ObjectType                  : MSSQL_INSTANCE
SlaAssignment               : DIRECT
ConfiguredSlaDomain         : 
EffectiveRetentionSlaDomain : 
EffectiveSlaDomain          : RubrikSecurityCloud.Types.GlobalSlaReply
PendingSla                  : 
ReplicatedObjects           : 
HasLogConfigFromSla         : True
HostLogRetention            : 
Id                          : cbdf206e-6dc2-5048-ac1b-0ca93283c3b7
LogBackupFrequencyInSeconds : 
LogBackupRetentionInHours   : 
Name                        : MSSQLSERVER
NumWorkloadDescendants      : 12
ReplicatedObjectCount       : 
SlaPauseStatus              : False
UnprotectableReasons        : 
AllOrgs                     : 
Cluster                     : RubrikSecurityCloud.Types.Cluster
DescendantConnection        : 
EffectiveSlaSourceObject    : 
LatestUserNote              : 
LogicalChildConnection      : 
LogicalPath                 : 
PendingObjectDeletionStatus : 
PhysicalPath                : {sh1-sql19ag-1a.rubrikdemo.com}
PrimaryClusterLocation      : 
SnapshotDistribution        : 

There was not a way to look at the above data and see SQL Server Host this instance belonged to. Only very recently, was the PhysicalPath populated with the host.

McDBAOptPHC commented 3 months ago

Ahh okay, so yeah if I do this (Get-RSCMSsqlInstance -List | Where-Object -FilterScript {$_.Name -eq $TargetHost.Name}).PhysicalChildConnection so if that's working as designed I'll mark this as closed.

clumnah commented 3 months ago

Hopefully you are not having to write your query like that and can just use Get-RscMssqlDatabase -HostName instead. :-)

On Apr 12, 2024, at 3:31 PM, McDBAOptPHC @.***> wrote:

Ahh okay, so yeah if I do this (Get-RSCMSsqlInstance -List | Where-Object -FilterScript {$_.Name -eq $TargetHost.Name}).PhysicalChildConnection so if that's working as designed I'll mark this as closed.

— Reply to this email directly, view it on GitHub https://github.com/rubrikinc/rubrik-powershell-sdk/issues/78#issuecomment-2052408976, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFKMBSHL6ISCMEGQAGZNCI3Y5AZAFAVCNFSM6AAAAABGASTJO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJSGQYDQOJXGY. You are receiving this because you were assigned.

SahFari commented 3 months ago

Get-RscMssqlDatabase: A parameter cannot be found that matches parameter name 'HostName'.

clumnah commented 3 months ago

Are you on version 1.0? Can you share the command you used to get that error?

SahFari commented 3 months ago

We are at CDM 8.1.3-p7 and are planning to upgrade to CDM 9.1.x on May 7.

PS C:\PS> $PSVersionTable

Name Value


PSVersion 7.3.9 PSEdition Core GitCommitId 7.3.9 OS Microsoft Windows 10.0.19045 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

PS C:\PS> PS C:\PS> Get-InstalledModule RubrikSecurityCloud

Version Name Repository Description


1.0 RubrikSecurityCloud PSGallery PowerShell Module for Rubrik Security Cloud. GraphQL schema version: v20240325-21 .

PS C:\PS> PS C:\PS> $Server = "SQLLAB01" PS C:\PS> PS C:\PS> Get-RscMssqlDatabase -HostName $Server Get-RscMssqlDatabase: A parameter cannot be found that matches parameter name 'HostName'. PS C:\PS>

clumnah commented 3 months ago

My mistake. I misread your original statement and thought it was about Get-RscMssqlInstance which is where the original problem came from.

Get-RscMssqlDatabase does not have a -Hostname parameter, it has a RscMssqlInstance parameter. That value would be gotten from Get-RscMssqlInstance.

SahFari commented 3 months ago

I got the command from the example in https://www.powershellgallery.com/packages/RubrikSecurityCloud/1.0/Content/Toolkit%5CPublic%5CGet-RscMssqlDatabase.ps1

$RscMssqlInstance = Get-RscMssqlInstance -HostName sql19.demo.com -clusterID hja87-ajb43-v4avna-hnjag Get-RscMssqlDatabase -Name AdventureWorks2019 -RscMssqlInstance $RscMssqlInstance

and as you said, there is not parameter for -Hostname.

clumnah commented 3 months ago

I am still confused then as to the issue. Can you state your issue to help me understand? I am not sure on next steps on how to help.

SahFari commented 3 months ago

I think we misunderstand each other!

My issue was with example in [Get-RscMssqlDatabase.ps1] and I think you need to take a look at it (Get-RscMssqlInstance -HostName in [Get-RscMssqlDatabase.ps1] )

And you wrote earlier: "Hopefully you are not having to write your query like that and can just use Get-RscMssqlDatabase -HostName instead. :-) "

clumnah commented 3 months ago

Ah..yes….I agree :-)

Yes, my earlier comment was a typo it should have been Get-RscMssqlInstance -Hostname.

clumnah commented 3 months ago

To close the overall thread, is it ok to close this issue out?

McDBAOptPHC commented 3 months ago

Yeah we should be good to close this one out.

Thanks,


Michael McConnell Database Administrator / ETL/Cogito Administrator | Optum Insight Supporting ProHealth Care

262-696-0332 @.**@.>

N17 W24100 Riverwood Dr. Suite 100 Waukesha, WI 53188

From: Chris Lumnah @.> Sent: Wednesday, April 17, 2024 10:35 AM To: rubrikinc/rubrik-powershell-sdk @.> Cc: McConnell, Michael N @.>; Author @.> Subject: Re: [rubrikinc/rubrik-powershell-sdk] Get-RscMssqlInstance -List returning invalid object types (Issue #78)

To close the overall thread, is it ok to close this issue out? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread. Message ID: rubrikinc/rubrik-powershell-sdk/issues/78/2061573566@ github. com

To close the overall thread, is it ok to close this issue out?

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/rubrikinc/rubrik-powershell-sdk/issues/78*issuecomment-2061573566__;Iw!!Brx_wp2njA!Q84jZ36J3Y4-kBEgBPjq15Cou3b5zwaISqhl1vL2MxdowYPvQCfJhwbiUgrqWDlNCh9AXc2X3w_QM9FKgUWumVHBgI94JQ$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/BHXJMCHTKNP6XLZG5V7QVPTY52JAXAVCNFSM6AAAAABGASTJO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRRGU3TGNJWGY__;!!Brx_wp2njA!Q84jZ36J3Y4-kBEgBPjq15Cou3b5zwaISqhl1vL2MxdowYPvQCfJhwbiUgrqWDlNCh9AXc2X3w_QM9FKgUWumVGfnHeP8g$. You are receiving this because you authored the thread.Message ID: @.**@.>>


This information is confidential and intended solely for the use of the individual or entity to whom it is addressed. If you have received this email in error please notify the sender or our Customer Support Center at (262) 928-2777. We have scanned this e-mail and its attachments for malicious content. However, the recipient should check this email and any attachments for the presence of viruses. ProHealth Care accepts no liability for any damage caused by any virus transmitted by this email.

SahFari commented 3 months ago

Yes, I agree!

Thanks