Posted by Jean-Paul Blanc
Wednesday, May 04, 2011 8:55:00 PM
Rate this Content
0
0 Votes
Pour savoir quel est le CLR (Common Language Runtime) utilisé dans un instance de PowerShell, on peut utiliser la variable $PSVersionTable
PS C:\> $PSVersionTable
Name Value
---- -----
CLRVersion 2.0.50727.4959
BuildVersion 6.1.7600.16385
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1
Pour que PowerShell démarre en utilisant un CLR 4.0 il faut positionner le fichier powershell.exe.config dans le dossier $PSHOME (C:\Windows\System32\WindowsPowerShell\v1.0)
powershell.exe.config :
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
Ce qui donne le résultat :
PS C:\Users\JPB> $PSVersionTable
Name Value
---- -----
PSVersion 2.0
PSCompatibleVersions {1.0, 2.0}
BuildVersion 6.1.7600.16385
PSRemotingProtocolVersion 2.1
WSManStackVersion 2.0
CLRVersion 4.0.30319.225
SerializationVersion 1.1.0.1