Cannot Change Forms or ASP.NET at the LocalHost Level with PS using Set-WebConfi

<p style=“margin: 0px 0px 1.5em; color: #11171a; text-transform: none; line-height: 1.5em; text-indent: 0px; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, Helvetica, Arial, ‘Segoe UI’, sans-serif; font-size: 14px; font-style: normal; font-weight: 400; word-spacing: 0px; white-space: normal; box-sizing: border-box; orphans: 2; widows: 2; background-color: #ffffff; text-rendering: optimizelegibility; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;”>I am attempting to create a PS Script to update or change the root level of IIS Authentication with settings for Forms Authentication and ASP.NET Impersonation. I am able to change Anonymous and Windows Authentication but I am having no luck with ASP.NET and Forms. I can change the ASP.NET and Form settings under the DefaultSiteWebSite directory but not at the localhost level. This is what I am trying but it does not work:</p>
<p style=“margin: 1.5em 0px; color: #11171a; text-transform: none; line-height: 1.5em; text-indent: 0px; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, Helvetica, Arial, ‘Segoe UI’, sans-serif; font-size: 14px; font-style: normal; font-weight: 400; word-spacing: 0px; white-space: normal; box-sizing: border-box; orphans: 2; widows: 2; background-color: #ffffff; text-rendering: optimizelegibility; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;”>Forms Authentication</p>
<p style=“margin: 1.5em 0px; color: #11171a; text-transform: none; line-height: 1.5em; text-indent: 0px; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, Helvetica, Arial, ‘Segoe UI’, sans-serif; font-size: 14px; font-style: normal; font-weight: 400; word-spacing: 0px; white-space: normal; box-sizing: border-box; orphans: 2; widows: 2; background-color: #ffffff; text-rendering: optimizelegibility; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;”>Set-WebConfiguration system.web/authentication ‘IIS:’ -value @{mode=‘Forms’}</p>
<p style=“margin: 1.5em 0px; color: #11171a; text-transform: none; line-height: 1.5em; text-indent: 0px; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, Helvetica, Arial, ‘Segoe UI’, sans-serif; font-size: 14px; font-style: normal; font-weight: 400; word-spacing: 0px; white-space: normal; box-sizing: border-box; orphans: 2; widows: 2; background-color: #ffffff; text-rendering: optimizelegibility; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;”>ASP.Net</p>
<p style=“margin: 1.5em 0px; color: #11171a; text-transform: none; line-height: 1.5em; text-indent: 0px; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, Helvetica, Arial, ‘Segoe UI’, sans-serif; font-size: 14px; font-style: normal; font-weight: 400; word-spacing: 0px; white-space: normal; box-sizing: border-box; orphans: 2; widows: 2; background-color: #ffffff; text-rendering: optimizelegibility; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;”>$aspNetImpersonation = Get-WebConfigurationProperty -filter system.web/identity -name impersonate -location “IIS:”
if( $aspNetImpersonation.Value -eq $true ){
Write-Host “ASP.NET Impersonation is already enabled”
} else {
$appCmdFilePath = “$Env:SystemRoot\System32\inetsrv\appcmd.exe”
& $appCmdFilePath set config “IIS:” -section:system.web/identity /impersonate:“True”
}
}</p>
<p style=“margin: 1.5em 0px 0px; color: #11171a; text-transform: none; line-height: 1.5em; text-indent: 0px; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, Helvetica, Arial, ‘Segoe UI’, sans-serif; font-size: 14px; font-style: normal; font-weight: 400; word-spacing: 0px; white-space: normal; box-sizing: border-box; orphans: 2; widows: 2; background-color: #ffffff; text-rendering: optimizelegibility; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;”>Any idea?</p>