On Linux/Mac:
Open any module .psd1 file and update/ add the following line:
ProcessorArchitecture = 'Amd64'
OR
ProcessorArchitecture ='x86'
Please note: ProcessorArchitecture='None' seems to work.
The module should be discoverable using Get-Module -ListAvailable and Import-Module should work fine as it does on Windows.
The module is not listed using Get-Module and Import-Module fails with this error:
Import-Module : Unable to load DLL 'api-ms-win-core-sysinfo-l1-1-0.dll': The specified module or one of its dependencies could not be found.
(Exception from HRESULT: 0x8007007E)
At line:1 char:1
+ Import-Module Standard
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], DllNotFoundException
+ FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand
> $PSVersionTable
Just ran across this myself. Was going to file a separate issue, but will throw my comments in here instead. I'm not sure if this is specific to compiled modules or not, but that's how I came across mine.
dotnet publish --self-contained..psd1 manifest for that moduleNestedModules in the .psd1ProcessorArchitecture of Amd64 in the .psd1ipmo : Unable to load shared library 'api-ms-win-core-sysinfo-l1-1-0.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libapi-ms-win-core-sysinfo-l1-1-0.dll: cannot open shared object file: No such file or directory
At line:1 char:16
+ cd /powerkube; ipmo ./output/PowerKube.psd1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], DllNotFoundException
+ FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand
Name Value
---- -----
PSVersion 6.1.1
PSEdition Core
GitCommitId 6.1.1
OS Linux 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Name Value
---- -----
PSVersion 6.1.1
PSEdition Core
GitCommitId 6.1.1
OS Microsoft Windows 10.0.17134
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
at System.Management.Automation.PsUtils.NativeMethods.GetSystemInfo(SYSTEM_INFO& lpSystemInfo)
at System.Management.Automation.PsUtils.GetProcessorArchitecture(Boolean& isRunningOnArm)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(String moduleManifestPath, ExternalScriptInfo manifestScriptInfo, Hashtable data, Hashtable localizedData, ManifestProcessingFlags manifestProcessingFlags, Version minimumVersion, Version maximumVersion, Version requiredVersion, Nullable`1 requiredModuleGuid, ImportModuleOptions& options, Boolean& containedErrors)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(ExternalScriptInfo scriptInfo, ManifestProcessingFlags manifestProcessingFlags, Version minimumVersion, Version maximumVersion, Version requiredVersion, Nullable`1 requiredModuleGuid, ImportModuleOptions& options)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(PSModuleInfo parentModule, String fileName, String moduleBase, String prefix, SessionState ss, Object privateData, ImportModuleOptions& options, ManifestProcessingFlags manifestProcessingFlags, Boolean& found, Boolean& moduleFileFound)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(String fileName, String moduleBase, String prefix, SessionState ss, ImportModuleOptions& options, ManifestProcessingFlags manifestProcessingFlags, Boolean& found)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName(ImportModuleOptions importModuleOptions, String name)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ProcessRecord()
at System.Management.Automation.Cmdlet.DoProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
I looked at this per @DWSR request.
Upon importing a module GetProcessorArchitechture() is called here
which is defined here
Which then calls GetStsyemInfo which is defined here
which is PINvoking the api-ms-win-core-sysinfo-l1-1-0.dll as defined here:
This is why on non-windows Unable to load shared library 'api-ms-win-core-sysinfo-l1-1-0.dll' happens
Will this be addressed for the final release of Powershell Core 7?
It is still an issue in Preview 4.
Again:
Will this be addressed for the final release of Powershell Core 7?
It is still an issue in RC1.
I believe https://github.com/PowerShell/PowerShell/pull/11046 will resolve this
I hope it was fixed in #11046 but we need to do manual check.
:tada:This issue was addressed in #11046, which has now been successfully released as v7.0.0-rc.2.:tada:
Handy links:
Thanks! Works now in Powershell 7 RC2!