I am running into a problem both with IIS 7 and IIS 8 using powershell and the webadministration module. It appears that after I set a property value, the updated property value is not visible on subsequent reads. The value does get changed in the backing applicationhost.config file and if I Remove-Module WebAdministration; Import-Module WebAdministration it will then read in the new values. its almost like the applicationhost.config file is getting cached on load or something.
Here is an example.
PS C:\Windows\system32> Get-ItemProperty IIS:\ -Name applicationPoolDefaults.enable32BitAppOnWin64; Set- ItemProperty IIS:\ -Name applicationPoolDefaults.enable32BitAppOnWin64 -Value $true -Verbose; Get-ItemProperty IIS:\ -Name applicationPoolDefaults.enable32BitAppOnWin64;PSPath : WebAdministration::\\REBAR-WEB-01\ PSParentPath : WebAdministration::\\REBAR-WEB-01 PSChildName : PSDrive : IIS PSProvider : WebAdministration IsInheritedFromDefaultValue : True IsProtected : False Name : enable32BitAppOnWin64 TypeName : System.Boolean Schema : Microsoft.IIs.PowerShell.Framework.ConfigurationAttributeSchema Value : False IsExtended : False VERBOSE: Performing operation "Set-ItemProperty" on Target "-path \\REBAR-WEB-01\ -name applicationPoolDefaults.enable32BitAppOnWin64 -value True". PSPath : WebAdministration::\\REBAR-WEB-01\ PSParentPath : WebAdministration::\\REBAR-WEB-01 PSChildName : PSDrive : IIS PSProvider : WebAdministration IsInheritedFromDefaultValue : True IsProtected : False Name : enable32BitAppOnWin64 TypeName : System.Boolean Schema : Microsoft.IIs.PowerShell.Framework.ConfigurationAttributeSchema Value : False IsExtended : False