Share via


Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0

Question

Monday, September 24, 2012 10:06 AM

I am binding my application with System.Management.Automation.dll and then calling powershell to invoke virtualmachine manager commands.

its working perfectly fine in windows 2008.

in windows 2012 server, with SCVMM 2012 SP1, when I tried to load the dll, its throwing following exception 

Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified., Error Type: System.IO.FileNotFoundException

All replies (4)

Monday, October 8, 2012 4:44 AM âś…Answered

It worked when I applied the workaround in - 

http://tameyourcloud.com/


Monday, October 8, 2012 4:45 AM

http://tameyourcloud.com/?p=170


Wednesday, January 30, 2013 10:11 AM

What was the answer? That website is down. Was it just a binding redirect?


Tuesday, February 12, 2013 11:14 AM | 1 vote

create powershell.exe.config with following 

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

Copy the file into powershell root directory.[C:\Windows\System32\WindowsPowerShell\v1.0]

2. Run following from command line 

reg add hklm\software\microsoft\netframework /v OnlyUseLatestCLR /t REG_DWORD /d 1
reg add hklm\software\wow6432node\microsoft\netframework /v OnlyUseLatestCLR /t REG_DWORD /d 1