arcserve-KB : RHA | 16.5 SP7 PowerShell module may not run on Windows 2008 and 2008 R2 due to incorrect CLRVersion

Last Update: 2018-02-08 03:02:24 UTC



16.5 SP7 PowerShell module may not run on Windows 2008 and 2008 R2 due to incorrect CLRVersion 


RHA 16.5 SP7 PowerShell module is compiled with .NET framework 4.0 hence it requires .NET framework 4.0 to be installed. Please refer to Installation Guide for details. The following issue applies where .NET framework 4.0 or above is already installed. 

 Error Message:

On Windows 2008 and 2008 R2, RHA PowerShell module may not be able to load successfully. When you try to run a RHA PowerShell cmdlet it reports error like: 

  • The term 'connect-xo' is not recognized as the name of a cmdlet, function, script file, or operable program.  

If you try to manually run C:\Program Files (x86)\CA\ARCserve RHA\Powershell Snapin\xo.ps1 you may get following error: 

  • Add-PSSnapin : Cannot load Windows PowerShell snap-in XOPowerShell because of the following error: Could not load file or assembly 'file:///C:\Program Files (x86)\CA\ARCserve RHA\Powershell Snapin\XOPowerShell.dll' or one of its dependen cies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. 



Root Cause:

The reason is on Windows 2008 and 2008 R2, a PowerShell session will by default load .NET CLR version 2.0, even if .NET 4.0 or above is installed. 


When you launch a PowerShell session and run $psversiontable you’ll see following output: 


  • PS>$psversiontable 
  • Name                           Value 
  • ----                           ----- 
  • CLRVersion                     2.0.50727.5477 
  • BuildVersion                   6.1.7601.17514 
  • PSVersion                      2.0 
  • WSManStackVersion              2.0 
  • PSCompatibleVersions           {1.0, 2.0} 
  • SerializationVersion  
  • PSRemotingProtocolVersion      2.1 

 Note the CLRVersion is 2.0.x. 



Perform following steps to change the loaded CLR version to 4.0 in PowerShell session: 

  1. Go to C:\Windows\System32\WindowsPowerShell\v1.0 and create a file named powershell.exe.configcontent is following: 
    • <?xml version="1.0"?> 
    • <configuration> 
    • <startup useLegacyV2RuntimeActivationPolicy="true"> 
    • <supportedRuntime version="v4.0.30319"/> 
    • <supportedRuntime version="v2.0.50727"/> 
    • </startup> 
    • </configuration> 
  2. Make a copy of this file and rename it to powershell_ise.exe.config
  3. Copy both of the two files (powershell.exe.config and powershell_ise.exe.config) to C:\Windows\SysWOW64\WindowsPowerShell\v1.0 as well if this is a x64 Windows.
  4. Launch C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe (on x86) or C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe (on x64)type command and check output: 
    • PS>$psversiontable 
      • Name                                                 Value 
      • ----                                                       ----- 
      • PSVersion                                          2.0 
      • PSCompatibleVersions                  {1.0, 2.0} 
      • BuildVersion                                     6.1.7601.17514 
      • CLRVersion                                       4.0.30319.42000 
      • WSManStackVersion                     2.0 
      • PSRemotingProtocolVersion      2.1 
      • SerializationVersion              
    • Make sure the CLRVersion is 4.0.x. 


Now RHA PowerShell module should work and you can use RHA PowerShell cmdlets as usual. 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request