.NET Framework - How to remove an item from ADFS web.config life

Asked By Alex V. on 08-May-11 11:25 AM
After much messing around with trying to uncomment the three unneeded
authentication types, I have decided to delete them. But to my great
dismay I could not even do that.

This is the script that DIDNT work (ADFS cant parse the .config file).

$xml=new-object xml
$xmlfile="C:\inetpub\adfs\ls\web.config"
$xml.load($xmlfile)
$xml.SelectNodes("/configuration/microsoft.identityServer.web/
localAuthenticationTypes/add")| where {$_.name -ne 'forms'} | foreach
{$_.name = "<!-- $_.name -->"}


This is what XML looks like:


I really appreciate your help,
Alex-




timric replied to Alex V. on 10-May-11 04:49 AM
It does not look like you ever saved back to the xml file after making
your changes.

Try adding the following line to the xml script after you have made your
changes:

$xml.save($xmlfile)

-Tim