4

I have a server which we are using for Batch processing.

I can login to the server with svc_account and run powershell -f file.ps1 and it runs fine in either version 2 or 3 by the following -

powershell -Version 2 -f file.ps1
powershell -f file.ps1

If I attempt to run it through our batch processor I get the following message

Version v4.0.30319 of the .NET Framework is not installed and it is required to run version 3 of Windows PowerShell.

This error occurs regardless of if I get my batch processor to run as v3 or v2 of powershell.

Thing is, .NET is installed. 3.5, 4.0 and 4.5 all exist on this server so it's something with the account login that it's for some reason not recognizing that .NET is installed.

whoisearth
  • 151
  • 1
  • 2
  • 7

2 Answers2

1

Add this key and try running it again:

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework] "InstallRoot"="C:\\Windows\\Microsoft.NET\\Framework64\\"

bentek
  • 2,333
  • 1
  • 16
  • 23
0

We were running powershell on the .NET framework version 4 (ala:

https://stackoverflow.com/q/2094694

) this involved using an activation configuration file

<startup useLegacyV2RuntimeActivationPolicy="true"> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup> 

and

set COMPLUS_ApplicationMigrationRuntimeActivationConfigPath = %~dp0

The important part in our case was that we were requesting framework version 4.6.1 and we only had 4.5 installed.

The error message is clearly inadequate because the framework version was not the issue. But because this question is the first hit you get when you search that error message this answer will hopefully prove useful to someone else.

hannasm
  • 151
  • 1
  • 4