When attempting to load the ManagementConsole.WebServices.dll module into PowerShell an error message is received stating
"Could not load file or assembly 'file:///C:\Program Files\AppSense\Management Center\Console\ManagementConsole.WebServices.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."
By default PowerShell uses the v2 .NET framework (as can be seen by executing $PSVersionTable and checking the CLRVersion) whilst the ManagementConsole.WebServices.dll requires the v4 .NET framework.
To enable PowerShell to use the v4 .NET framework create a 'powershell.exe.config' file with the below content and copy to the following locations:
- C:\Windows\SysWOW64\WindowsPowerShell\v1.0 (if the machine is 64 bit)
Reopen the PowerShell process, check the CLRVersion loaded in PowerShell.exe is now v4, and the script succeeds.