PureStorage-OpenConnect / powershell-toolkit-3

PowerShell Toolkit 3.x
Apache License 2.0
6 stars 1 forks source link

Exception while loading dbatools #74

Closed aguzev closed 1 year ago

aguzev commented 1 year ago

Review issue with Import- PS1s.

PS Microsoft.PowerShell.Core\FileSystem::\Mac\Home\Desktop\github-purestorage\powershell-toolkit-3> .\Import-PureStoragePowerShellToolkit.Core.ps1 Import PureStoragePowershellToolkit.FlashArray Import PureStoragePowershellToolkit.DatabaseTools Import-Module: \Mac\Home\Desktop\github-purestorage\powershell-toolkit-3\Import-PureStoragePowerShellToolkit.Core.ps1:46 Line | 46 | Import-Module ".\$ModuleName" | ~~~~~~~ | Could not import | \Mac\Home\Documents\PowerShell\Modules\dbatools\1.1.146\bin\smo\coreclr\Microsoft.SqlServer.XE.Core.dll : | MethodInvocationException: | \Mac\Home\Documents\PowerShell\Modules\dbatools\1.1.146\internal\scripts\libraryimport.ps1:150 Line | 150 | | [Reflection.Assembly]::LoadFrom($assemblyPath) | | ~~~~~~~~~~~~ | Exception calling "LoadFrom" with "1" argument(s): "Could | not load file or assembly | | '\Mac\Home\Documents\PowerShell\Modules\dbatools\1.1.146\bin\smo\coreclr\Microsoft.SqlServer.XE.Core.dll'. The | | specified module could not be found." PS Microsoft.PowerShell.Core\FileSystem::\Mac\Home\Desktop\github-purestorage\powershell-toolkit-3> .\Import-PureStoragePowerShellToolkit.ps1 Import PureStoragePowershellToolkit.FlashArray Import PureStoragePowershellToolkit.DatabaseTools Import PureStoragePowershellToolkit.WindowsAdministration Import PureStoragePowershellToolkit.Reporting Import PureStoragePowershellToolkit.Exchange

aguzev commented 1 year ago

@barkz , what happens when you follow these steps?

  1. Open a new PowerShell <-- important. Avoid calling any script before step 2.
  2. Import-Module dbatools
  3. .\Import-PureStoragePowerShellToolkit.Core.ps1
aguzev commented 1 year ago

I have reproduced the issue on Ubuntu.

aguzev commented 1 year ago

It's a bug in dbatools 1.1. Downgrading to the most recent 1.0.x resolves the issue.

Surprisingly, they released dbatools 2.0.0 today and it does not have this bug. But upgrading to dbatools 2.0 requires full regression testing for PureStoragePowerShellToolkit.DatabaseTools.