rubrikinc / rubrik-powershell-sdk

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

Remove-RscMssqlLiveMount throwing errors trying to unmount #62

Closed k-laughman closed 5 months ago

k-laughman commented 5 months ago

RSC Powershell Module Version - .27 Powershell version - 5.1

I have been able to successfully mount and umount SQL Live Mounts through the RSC playground, but an attempt to perform the same operations with the Powershell cmdlets throws errors on the mount and unmount. In this case, I have a Live Mount that is mounted manually, that throws errors trying to delete it:



PS C:\WINDOWS\system32> echo $MssqlLiveMount

CdmId               : 635ea7c6-152d-4931-a14c-12019086c02c
CreationDate        : 3/27/2024 4:22:25 PM
Fid                 : 3184cf0d-af41-56d9-93e8-f043f9ca1576
IsReady             : True
MountRequestId      :
MountedDatabaseId   : b366a03e-c41f-404d-9668-50c93397be1c
MountedDatabaseName : graphql
OwnerId             : 0bf8daca-5ab1-4a79-a3a8-7e40a0b544e0
RecoveryPoint       : 3/25/2024 8:22:10 AM
UnmountRequestId    :
Cluster             :
SourceDatabase      :
TargetInstance      :`

PS C:\WINDOWS\system32> Remove-RscMssqlLiveMount -MssqlLiveMount $MssqlLiveMount
The following exception occurred while retrieving member "id": "Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."
At C:\Program Files\WindowsPowerShell\Modules\RubrikSecurityCloud\0.27\Toolkit\Public\Remove-RscMssqlLiveMount.ps1:55 char:34
+         $query.Var.input.id = "$($MssqlLiveMount.Fid)"
+                                  ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], ExtendedTypeSystemException
    + FullyQualifiedErrorId : CatchFromBaseGetMember

Exception calling "Invoke" with "0" argument(s): "Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."
At C:\Program Files\WindowsPowerShell\Modules\RubrikSecurityCloud\0.27\Toolkit\Public\Remove-RscMssqlLiveMount.ps1:59 char:9
+         $result = $query.Invoke()
+         ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FileNotFoundException
clumnah commented 5 months ago

The errors above should be related to running in Windows Powershell vs Powershell 7. Can you confirm the following?

  1. Are you seeing this issue in Windows Powershell AND Powershell 7 or just Windows Powershell?
  2. Can you update to .29 and see if the issue still exists? This should be resolved in the latest update.
k-laughman commented 5 months ago

Hi,

I have confirmed through some additional testing that the .29 version is now working when using PowerShell 7. However, the .29 version is still failing with the same errors on PowerShell 5.1:

PS C:\WINDOWS\system32> get-module

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script     2.0.0      PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler...}
Script     0.29       RubrikSecurityCloud                 {Connect-Rsc, Disconnect-Rsc, Get-RscCmdlet, Get-RscFileset...}

PS C:\WINDOWS\system32> echo $MssqlLiveMount

CdmId               : ed773c28-09fe-4adc-8fd0-aad227404a1e
CreationDate        : 4/3/2024 12:43:28 PM
Fid                 : 57aafa6b-58f1-502c-9abf-9e5067c66090
IsReady             : True
MountRequestId      :
MountedDatabaseId   : 333ebb3b-f00f-4764-bfb3-069496ed281d
MountedDatabaseName : graphql
OwnerId             : 0bf8daca-5ab1-4a79-a3a8-7e40a0b544e0
RecoveryPoint       : 4/1/2024 8:22:44 AM
UnmountRequestId    :
Cluster             :
SourceDatabase      :
TargetInstance      :

PS C:\WINDOWS\system32> Remove-RscMssqlLiveMount -MssqlLiveMount $MssqlLiveMount
The following exception occurred while retrieving member "id": "Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."
At C:\Program Files\WindowsPowerShell\Modules\RubrikSecurityCloud\0.29\Toolkit\Public\Remove-RscMssqlLiveMount.ps1:55 char:34
+         $query.Var.input.id = "$($MssqlLiveMount.Fid)"
+                                  ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], ExtendedTypeSystemException
    + FullyQualifiedErrorId : CatchFromBaseGetMember

Exception calling "Invoke" with "0" argument(s): "Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or
one of its dependencies. The system cannot find the file specified."
At C:\Program Files\WindowsPowerShell\Modules\RubrikSecurityCloud\0.29\Toolkit\Public\Remove-RscMssqlLiveMount.ps1:59 char:9
+         $result = $query.Invoke()
+         ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FileNotFoundException

I will wait for .30 to be released next week and retry/update with that. Thanks.

SahFari commented 5 months ago

It works after upgrade to version 1.0

k-laughman commented 5 months ago

Agreed - just tested it out and it all seems to work with the updated version now. Thank you