Import-Module: Could not load file or assembly 'Microsoft.CertificateServices.PKIClient.Cmdlets, Culture=neutral, PublicKeyToken=null'. Format of the executable (.exe) or library (.dll) is invalid.
Exception :
Type : System.BadImageFormatException
Message : Could not load file or assembly 'Microsoft.CertificateServices.PKIClient.Cmdlets, Culture=neutral, PublicKeyToken=null'. Format of the executable
(.exe) or library (.dll) is invalid.
FileName : Microsoft.CertificateServices.PKIClient.Cmdlets, Culture=neutral, PublicKeyToken=null
TargetSite :
Name : LoadBinaryModule
DeclaringType : Microsoft.PowerShell.Commands.ModuleCmdletBase
MemberType : Method
Module : System.Management.Automation.dll
InnerException :
Type : System.BadImageFormatException
Message : Could not load file or assembly 'C:\WINDOWS\Microsoft.NET\assembly\GAC_64\Microsoft.CertificateServices.PKIClient.Cmdlets\v4.0_10.0.0.0__31bf3856a
d364e35\Microsoft.CertificateServices.PKIClient.Cmdlets.dll'. Format of the executable (.exe) or library (.dll) is invalid.
FileName : C:\WINDOWS\Microsoft.NET\assembly\GAC_64\Microsoft.CertificateServices.PKIClient.Cmdlets\v4.0_10.0.0.0__31bf3856ad364e35\Microsoft.Certificate
Services.PKIClient.Cmdlets.dll
TargetSite :
Name : LoadFromPath
DeclaringType : System.Runtime.Loader.AssemblyLoadContext
MemberType : Method
Module : System.Private.CoreLib.dll
Source : System.Private.CoreLib
HResult : -2147024703
StackTrace :
at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
at System.Management.Automation.PowerShellAssemblyLoadContext.Resolve(AssemblyLoadContext loadContext, AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.GetFirstResolvedAssemblyFromResolvingEvent(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
Source : System.Management.Automation
HResult : -2147024703
StackTrace :
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadBinaryModule(PSModuleInfo parentModule, String moduleName, String fileName, Assembly assemblyToLoad, String
moduleBase, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags, String prefix, Boolean loadTypes, Boolean loadFormats,
Boolean& found, String shortModuleName, Boolean disableFormatUpdates)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleNamedInManifest(PSModuleInfo parentModule, ModuleSpecification moduleSpecification, String moduleBase,
Boolean searchModulePath, String prefix, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags, Boolean loadTypes, Boolean
loadFormats, Object privateData, Boolean& found, String shortModuleName, Nullable`1 manifestLanguageMode)
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.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.LoadUsingExtensions(PSModuleInfo parentModule, String moduleName, String fileBaseName, String extension, String
moduleBase, String prefix, SessionState ss, ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags, Boolean& found, Boolean& moduleFileFound)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadUsingModulePath(PSModuleInfo parentModule, Boolean found, IEnumerable`1 modulePath, String name, SessionState
ss, ImportModuleOptions options, ManifestProcessingFlags manifestProcessingFlags, PSModuleInfo& module)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName(ImportModuleOptions importModuleOptions, String name)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName_WithTelemetry(ImportModuleOptions importModuleOptions, String name)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ProcessRecord()
at System.Management.Automation.Cmdlet.DoProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
CategoryInfo : NotSpecified: (:) [Import-Module], BadImageFormatException
FullyQualifiedErrorId : System.BadImageFormatException,Microsoft.PowerShell.Commands.ImportModuleCommand
InvocationInfo :
MyCommand : Import-Module
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 5
Line : Import-Module PKI
PositionMessage : At line:1 char:1
+ Import-Module PKI
+ ~~~~~~~~~~~~~~~~~
InvocationName : Import-Module
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
Prerequisites
Steps to reproduce
Expected behavior
No error.Actual behavior
Import-Module: Could not load file or assembly 'Microsoft.CertificateServices.PKIClient.Cmdlets, Culture=neutral, PublicKeyToken=null'. Format of the executable (.exe) or library (.dll) is invalid.Error details
Environment data
Visuals
No response