Compartilhar via


Removing an invalid WebConfigModification using Powershell

SharePoint supports adding web.config modifications programmatically. Here is an example from MSDN. Each modification is stored with a web application, and you are able to list them using the following command:

$webapp = Get-SPWebApplication https://<your web app url>
$w.WebConfigModifications

If you want to remove an invalid entry, use the following commands:

$modification = $webapp.WebConfigModifications | where { $_.Name -eq "<the name of your key>" }
$webapp.WebConfigModifications.Remove($modification)
$webapp.Update()