3

I am trying to do what is suggested in the answer here: How do I set the .NET Framework Version when using New-WebAppPool?

and using the command:

Set-ItemProperty C:\inetpub\temp\appPools\DefaultAppPool managedRuntimeVersion v4.0

I get this error however

Set-ItemProperty : Property System.String managedRuntimeVersion=v4.0 does not exist. At line:1 char:17 + Set-ItemProperty <<<< C:\inetpub\temp\appPools\DefaultAppPool managedRuntimeVersion v4.0 + CategoryInfo: ReadError: (System.String managedRuntimeVersion=v4.0:PSNoteProperty) [IOException + FullyQualifiedErrorId :SetPropertyError,Microsoft.PowerShell.Commands.SetItemPropertyCommand

I think that I loaded the Web Administration module correctly (right clicked on the taskbar icon and selected "Import System Modules" and then tried the commands in that shell) and I've also tried using the command and explicitly stating the parameters and it still occurs. Same problem happens with other properties like AutoStart.

Does anyone know what I might be doing wrong?

Community
  • 1
  • 1
Marzipan
  • 95
  • 2
  • 9

2 Answers2

5

C:\ is the from the file system provider. Keith's answer in the SO question you linked is using the IIS provider IIS:\.

Set-ItemProperty IIS:\AppPools\<pool_name> managedRuntimeVersion v4.0
Andy Arismendi
  • 50,577
  • 16
  • 107
  • 124
1

C:\inetpub\temp\appPools\DefaultAppPool - you are pointing to the filesystem.

Use the IIS provider to point to the App Pool.

It will be something like IIS:\AppPools\Name

manojlds
  • 290,304
  • 63
  • 469
  • 417
  • I actually tried this originally and it said "Cannot find drive. A drive with the name "IIS" does not exist." I was originally looking at this site http://www.jonoble.com/blog/2011/10/7/finding-iis-application-pool-states-with-powershell.html and they say that you should be able to navigate to it using cd but that doesn't work for me either. So I thought perhaps mine was somewhere else and I found that AppPools folder in inetpub/temp – Marzipan Feb 14 '12 at 22:03
  • When I ran into the "Cannot find drive. A drive with the name "IIS" does not exist." error, I simply needed to add this line at the beginning of my script: import-module webadministration – Elijah Lofgren Aug 13 '15 at 20:07