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

**URL:** <https://forums.powershell.org/t/cannot-change-forms-or-asp-net-at-the-localhost-level-with-ps-using-set-webconfi/13501>\
**Category:** PowerShell Help\
**Created:** [December 4, 2019, 11:02am UTC](https://forums.powershell.org/t/cannot-change-forms-or-asp-net-at-the-localhost-level-with-ps-using-set-webconfi/13501 "2019-12-04T11:02:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vvicin01](https://avatars.discourse-cdn.com/v4/letter/v/85e7bf/32.png) [@vvicin01](https://forums.powershell.org/u/vvicin01)\
**Post date:** [December 4, 2019, 11:02am UTC](https://forums.powershell.org/t/cannot-change-forms-or-asp-net-at-the-localhost-level-with-ps-using-set-webconfi/13501/1 "2019-12-04T11:02:11Z")

</div>

\<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](http://ASP.NET) Impersonation. I am able to change Anonymous and Windows Authentication but I am having no luck with [ASP.NET](http://ASP.NET) and Forms. I can change the [ASP.NET](http://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](http://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\>

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:30pm UTC](https://forums.powershell.org/t/cannot-change-forms-or-asp-net-at-the-localhost-level-with-ps-using-set-webconfi/13501/2 "2024-05-16T20:30:57Z")

</div>


