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

Welcome Forums General PowerShell Q&A Cannot Change Forms or ASP.NET at the LocalHost Level with PS using Set-WebConfi

Viewing 0 reply threads
  • Author
    Posts
    • #191623
      Participant
      Topics: 1
      Replies: 0
      Points: 13
      Rank: Member

      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:

      Forms Authentication

      Set-WebConfiguration system.web/authentication 'IIS:\' -value @{mode='Forms'}

      ASP.Net

      $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"
      }
      }

      Any idea?

Viewing 0 reply threads
  • You must be logged in to reply to this topic.