On a Windows Small Business Server 2011 Essentials server, elevated PowerShell command Import-Module AdmPwd.PS failed and outputted the following:

Import-Module : Could not load file or assembly 'file:///C:\Windows\system32\WindowsPowerShell\v1.0\Modules\AdmPwd.PS\AdmPwd.PS.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
At line:1 char:14
+ Import-Module <<<<  AdmPwd.PS
    + CategoryInfo          : NotSpecified: (:) [Import-Module], BadImageFormatException
    + FullyQualifiedErrorId : System.BadImageFormatException,Microsoft.PowerShell.Commands.ImportModuleCommand

PowerShell command Get-ExecutionPolicy outputted RemoteSigned, which, as far as I'm aware, is sufficient but PowerShell command Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force didn't resolve the problem anyway.

https://social.technet.microsoft.com/Forums/Windows/en-US/fa0b7074-571d-4d84-b3b1-b214443b81b0/laps-importmodule-admpwdps-fail?forum=winserverpowershell and https://flamingkeys.com/deploying-the-local-administrator-password-solution-part-2/ suggested that upgrading the installation of Windows Management Framework / PowerShell would resolve the problem.

PowerShell command $PSVersionTable.PSVersion outputted the following:

Major Minor Build Revision
----- ----- ----- --------
2 0 -1 -1

https://www.microsoft.com/en-us/download/details.aspx?id=46899 says:

Supported Operating System
Windows 10 , Windows 7, Windows 8, Windows 8.1, Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server 2016, Windows Vista

Active Directory: (requires AD schema extension)
• Windows 2003 SP1 or later.
Managed machines:
• Windows Server 2003 SP2 or later, or Windows Server 2003 x64 Edition SP2 or later.
Note: Itanium-based machines are not supported.
Management tools:
• .NET Framework 4.0
PowerShell 2.0 or later

https://community.spiceworks.com/topic/1970987-sbs-2011-and-powershell-v3 and https://blogs.technet.microsoft.com/sbs/2012/12/15/windows-management-framework-3-0-applicability-on-windows-small-business-server-20082011-standard/ strongly suggest that there are compatibility issues with Windows SBS 2011 and PowerShell 3.


https://tridion.stackexchange.com/questions/4497/import-module-could-not-load-file-or-assembly-when-running-2013-sp1-db-upgra and https://code.msdn.microsoft.com/windowsdesktop/Solution-for-management-of-ae44e789/view/Discussions/12 suggested that this problem (1) was caused by the PowerShell module being compiled for .NET Framework version 4 but, by default, PowerShell only loads .NET Framework version 2 and (2) could be resolved by creating file C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe.config with content:

<?xml version="1.0"?>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0.30319"/>
        <supportedRuntime version="v2.0.50727"/>
        <supportedRuntime version="v4.6" />    

I verified that this resolved the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.