Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import-Module after a Update-Module/Install-Module? #138

Open
SahFari opened this issue Aug 27, 2024 · 4 comments
Open

Import-Module after a Update-Module/Install-Module? #138

SahFari opened this issue Aug 27, 2024 · 4 comments

Comments

@SahFari
Copy link

SahFari commented Aug 27, 2024

Don't know if it's customary to run Import-Module after an Update-Module or Install-Module -RequiredVersion or not, however, this is what I have done.

P.s. I am on PowerShell 7.4.5. using the latest version of vsCode. D.s.

I updated the module


Update-Module RubrikSecurityCloud -Scope AllUsers -Force

Import-Module RubrikSecurityCloud -Force -Verbose

Connect-Rsc -IfNeeded | Out-Null

I have been able to connect to RSC, once afer that has other RSC commands failed, including Connect-Rsc.

I have closed and reopend vsCode, more than 5 times yesterday and I think another 5 times today. I have rebooted my PC as well.

I have uninstalled all other versions leaving 1.7.
Same behavier after an import-module.
Reinstalled version 1.5, uninstalled 1.7. New import-moudle, closed and reopend vsCode.

I have now reinstalled 1.7 and 1.8 without running import-module, closed and reopened vsCode. RSC commands I have tested works.

Connect-Rsc -IfNeeded | Out-Null

PS C:\PS> Connect-Rsc -IfNeeded | Out-Null
WARNING: Connect_Rsc: The installed RSC SDK version does not match the server version.

PS C:\PS> Get-RscEventSeries

LastActivityStatus   : RUNNING
ObjectType           : MSSQL

These are the errors:

PS C:\PS> Get-RscCluster
Invoke-Rsc: C:\Program Files\PowerShell\Modules\RubrikSecurityCloud\1.8\Toolkit\Public\Get-RscCluster.ps1:160:21
Line |
 160 |          $response = Invoke-Rsc $query
     |                      ~~~~~~~~~~~~~~~~~
     | One or more errors occurred. (Could not load file or assembly 'Microsoft.IdentityModel.Abstractions, Version=8.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (0x80131621))

PS C:\PS> Connect-Rsc
Connect-Rsc: One or more errors occurred. (Could not load file or assembly 'Microsoft.IdentityModel.Abstractions, Version=8.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (0x80131621))

PS C:\PS> DisConnect-Rsc
Disconnect-Rsc: One or more errors occurred. (Could not load file or assembly 'Microsoft.IdentityModel.Abstractions, Version=8.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (0x80131621))

Uninstall-Module RubrikSecurityCloud -MinimumVersion 1.7 -Force

Import-Module RubrikSecurityCloud -Force -Verbose

Connect-Rsc -IfNeeded | Out-Null


PS C:\PS> Connect-Rsc
Connect-Rsc: One or more errors occurred. (Could not load file or assembly 'Microsoft.IdentityModel.Abstractions, Version=8.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (0x80131621))

PS C:\PS> Get-RscCluster
Invoke-Rsc: C:\Program Files\PowerShell\Modules\RubrikSecurityCloud\1.8\Toolkit\Public\Get-RscCluster.ps1:160:21
Line |
 160 |          $response = Invoke-Rsc $query
     |                      ~~~~~~~~~~~~~~~~~
     | One or more errors occurred. (Could not load file or assembly 'Microsoft.IdentityModel.Abstractions, Version=8.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (0x80131621))

PS C:\PS> DisConnect-Rsc
Disconnect-Rsc: One or more errors occurred. (Could not load file or assembly 'Microsoft.IdentityModel.Abstractions, Version=8.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (0x80131621))


@rynardtspies
Copy link
Collaborator

@SahFari

Could you let me know if you're only using the terminal in VSCode?

I am unable to reproduce this.

What OS version are you running?

In the past, I have seen inconsistencies in dependency/package resolution between the terminal in VSCode and the PowerShell Console. Could you try again using the PowerShell console outside of VSCode?

@SahFari
Copy link
Author

SahFari commented Aug 27, 2024

@rynardtspies

I mostly use Editor in VsCode.

I will do new tests tomorrow:

  • Running commands from VSCode terminal
  • Running commands from PowerShell 7 (pwsh.exe)
  • I can do other tests as well, using a lab server where I haven’t upgraded PS 7 and I think that VSCode is older on that server.

I use WIN 10:
Major Minor Build Revision


10 0 19045 0

@SahFari
Copy link
Author

SahFari commented Aug 28, 2024

@rynardtspies
Hi,
I installed 1.9 on my PC and on a lab server. I removed all other versions from my pc not on the lab server.
The lab server is on PowerShell 7.4.4. Mine PC is on PowerShell 7.4.5.

  1. I need to import the module each time I start either PowerShell 7 Console (pwsh) or VSCode. This only on my PC, not on the lab server.
  2. I get the same error in VSCode if I if use PowerShell Extension. It works fine with pwsh. This both from the console or editor. It is the same behavior on both tested PC/server.

This screenshot is from the lab server

image

These screenshot is from my pc

image

image

image

@SahFari
Copy link
Author

SahFari commented Aug 28, 2024

Update: don't need to import the module each time I start VSCode/PowerShell Console!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@rynardtspies @SahFari and others