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

Unable to import DBATools over WinRM or over PowerShell remote tools. #8595

Closed
j0nathontayl0r opened this issue Oct 18, 2022 · 2 comments
Closed

Comments

@j0nathontayl0r
Copy link

j0nathontayl0r commented Oct 18, 2022

Verified issue does not already exist?

I have searched and found no existing issue, I did make a comment in Issue 8198 which has been closed and merged. But this issue with PSRemote and dbatools persists.

What error did you receive?

MethodInvocationException: C:\Users\Administrator\Documents\PowerShell\Modules\dbatools\1.1.140\internal\scripts\libraryimport.ps1:150
Line |
 150 |                      [Reflection.Assembly]::LoadFrom($assemblyPath)
     |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly
     | 'C:\Users\Administrator\Documents\PowerShell\Modules\dbatools\1.1.140\bin\smo\coreclr\Microsoft.SqlServer.XE.Core.dll'. The specified module could not be found."
Could not import C:\Users\Administrator\Documents\PowerShell\Modules\dbatools\1.1.140\bin\smo\coreclr\Microsoft.SqlServer.XEvent.Linq.dll :
MethodInvocationException: C:\Users\Administrator\Documents\PowerShell\Modules\dbatools\1.1.140\internal\scripts\libraryimport.ps1:150
Line |
 150 |                      [Reflection.Assembly]::LoadFrom($assemblyPath)
     |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly
     | 'C:\Users\Administrator\Documents\PowerShell\Modules\dbatools\1.1.140\bin\smo\coreclr\Microsoft.SqlServer.XEvent.Linq.dll'. The specified module could not be found."

Steps to Reproduce

# provide your command(s) executed pertaining to dbatools
# please include variable values (redacted or fake if needed) for reference

Run the following PowerShell block over either WinRM or PowerShell remote tools:

Import-Module -Name "dbatools"

However, importing DBAtools over RDP works fine when running the same Import-Module snippit above.

Please note, this issue does not occur in DBA tools version "1.0.114" and below, only in later versions. This same issue was identified by @wsuhoey in Issue 8198 but in the latest version of DBAtools v1.1.140 I'm still seeing the same errors and Issue 8198 has now been closed and merged into the latest release which is v1.1.140 at time of writing.

Please confirm that you are running the most recent version of dbatools

ModuleType Version PreRelease Name ExportedCommands


Script 1.1.140 dbatools {Select-DbaObject, Set-DbatoolsConfig, Add-DbaAgDatabase, Add-DbaAgListener…}

Other details or mentions

None.

What PowerShell host was used when producing this error

PowerShell Core (pwsh.exe), VS Code (terminal), VS Code (integrated terminal)

PowerShell Host Version

Name Value


PSVersion 7.2.6
PSEdition Core
GitCommitId 7.2.6
OS Linux 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

SQL Server Edition and Build number

SQLServer2017 and build number 14.0.3436.1

.NET Framework Version

.NET 6.0.8

@j0nathontayl0r j0nathontayl0r added bugs life triage required New issue that has not been reviewed by maintainers labels Oct 18, 2022
@potatoqualitee
Copy link
Member

Thanks for the report. I'm currently working on updating the library and the XE libraries will disappear entirely (not sure where they went tho ???) so keep a lookout. For reference: microsoft/sqlmanagementobjects#114

@andreasjordan andreasjordan added smo fix in 2.0 and removed triage required New issue that has not been reviewed by maintainers labels Oct 20, 2022
@potatoqualitee
Copy link
Member

this is fixed in 2.0 which will be released within a couple weeks
image

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

No branches or pull requests

3 participants