Jim Brown
Jim Brown

Reputation: 498

Why can't I add properties to a Membership Provider using PowerShell WebAdministration?

I have a web.config file, I need to add the SqlMembershipProvider to it for FBA, and I wanted to do it using the WebAdministration module for IIS through PowerShell.

I used the Add-WebConfiguration cmdlet and can add the provider correctly but it only takes the name and type properties and drops the rest. I had connectionStringName, enablePasswordReset, passwordFormat, and others in a hash table that I was passing to the cmdlet but it only took those two out of the hash table and ignored the rest. The same thing happened for my RoleManager provider.

I then tried Add-WebConfigurationProperty to add applicationName to it and got this message:

"Property applicationName is not found on add."

When I opened the web.config file in Visual Studio 2010 I found that the schema file defining configuration files shows only two properties on membership/add: name and type.

Where are all the others?

It seems that the WebAdministration module is validating the properties added using Add-WebConfigurationProperty against the schema file to see if it's a valid property.

The problem is that they are valid properties but aren't defined in the schema, so how do I override this behavior and "make" the module add my property that I know is valid??

Upvotes: 2

Views: 450

Answers (1)

Jim Brown
Jim Brown

Reputation: 498

I was not able to figure out why the Web Administration module doesn't accept any other parameters. I resorted to using XDocument to manually manipulate the XML file. Oh well, maybe they'll fix it some day...

Upvotes: 0

Related Questions