2011-01-08 29 views
7

Uzak bir Powershell 2.0 oturumunun içinde, [Reflection.Assembly] :: LoadFrom kullanarak. Net 4.0 derlemesi yüklemeye çalışıyorum. Yerel olarak çalışır, powershell.exe.config dosyasına yaptığım bir değişiklik nedeniyle, ancak "Bu derleme, bir çalışma zamanı tarafından oluşturuldu ..." ile başarısız bir uzaktan oturumda istisna.Powershell 2.0 Bir yükleme yükleme. Net 4.0 dll

Her iki makinede .Net 2.0 ve 4.0 bulunur ve powershell.exe.config dosyasında x86 ve x64 bit powershell çalıştırılabilirleri bulunur. RuntimeVersion

Mecburum \ Software \ Wow6432Node \ Microsoft Powershell \ \ 1 \ PowerShellEngine \: HKLM: \ Software \ Microsoft \ Powershell \ 1 \ PowerShellEngine \ runtimeVersion HKLM ben de sunucu powershell kayıt defteri anahtarlarını değiştirerek denedim Bir şey eksik, ama ne olduğunu bilmiyorum.

Düzenleme: Aşağıda, çalıştırdığım kodun bir örneği verilmiştir.

PS C:\>Enter-PSSession -ComputerName server1 
[server1]: PS C:\stuff> dir *.dll | foreach { [Reflection.Assembly]::LoadFrom($_.FullName) } 
+0

Lütfen kullandığınız komutu gösteriniz .. –

cevap

7

çözüm ac oluşturmaktır: System32 \ wsmprovhost.exe.config dosyası ve ac \ windows \: \ windows \ SysWOW64 \ benzer sunucuda, dosyanın, wsmprovhost.exe.config

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

http://poshcode.com/2045 sadece powershell.exe dosyası gibi yapılandırılması gereken wsmprovhost.exe ima aşağıdaki makaleye, bulunan: azından ben buldum. http://tfl09.blogspot.com/2010/08/using-later-versions-of-net-framework.html