-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xWebConfigPropertyCollection: support single property collection #379
Comments
Hello @SergeDubovsky. Anytime you need to set a web configuration property using a hash table, that indicates it is a collection, which would normally require xWebConfigPropertyCollection to manage it. In this case, the collection only has one property, so xWebConfigPropertyCollection will not work. However you can still manage a one property collection like this with xWebConfigProperty:
The main difference is collections require the 'add' element. |
Maybe we should add this as an example? Labeled it as documentation, and help wanted so that anyone in the community can run with this. |
There are some more issues. When I have several variables in the collection, the contents of
It would be better to use something of this sort to check if there is an entry in the collection: |
@SergeDubovsky Could you open a new issue for this? It seems it not the same issue as before? |
The issue is "evolved" :) I am trying to use the suggested example for the task, I was trying to implement. I don't think, the xWebConfigProperty resource will work for it, as @regedit32 suggested.
If there are no items in the collection, it would fail with this: In both cases, Set-WebConfigurationProperty is not what we need. It should be Add-WebConfigurationProperty I would open a new issue. |
@regedit32 Could you possible assist here please? 🙂 Is it functionality missing so this should be an enhancement? |
@johlju Yes, after testing some more I can see it is not going to work as-is with xWebConfigProperty. Since this is a collection with a single property that we're trying to solve here, it seems like the solution should go in the xWebConfigPropertyCollection resource to be able to handle this type of collection. Otherwise we'd be adding logic to xWebConfigProperty to conditionally handle single property collections, which doesn't seem to be the intended scope of that resource. xWebConfigPropertyCollection resource schema.mof defines ItemPropertyName as a key property in order to support collections with 2 or more properties, for example this collection: Without ItemPropertyName defined as a key, there would be resource conflicts for that collection, but at the same time it blocks the ability to manage a single property collection like: Unless I'm overlooking something, in either case, I'm not sure if it that qualifies as missing functionality or a desired enhancement. |
So basically we change this issue so that the enhancement is to support single property collection in the resource xWebConfigPropertyCollection? |
I haven't put much thought into a potential solution yet, but yes, that makes the most sense to me. |
Renamed this issue. Labeling this as an enhancement, and help wanted. |
I just got this working using the following syntax:
|
Worked for me with xWebAdministration 2.7.0.0. |
I suggest that we add that to an example then. |
That would be great, the current documentation for xWebAdministration is not always super straightforward. I was happy to find the above example by browsing the issues :) |
@rnsc agree, this resource module needs more love (help) from the community in many areas. |
I believe this issue also occurs when trying to add another default document.
|
So there's a workaround to set a single field collection, the resource was set up to be able to do two field collections, how about collections that have three or more fields, like system.applicationHost/sites/siteDefaults/logFile/customFields which has properties logFieldName, sourceName, SourceType? Shouldn't this implementation have a hashtable parameter rather than key/property? Like so -
|
Can't figure out a way to do this on site level instead of machine level. Does anyone have any idea? |
@Igor-X Your issue is already perhaps raised in #534 - see examples there? |
I am trying to add a Server Variable to rewrite. In the C:\Windows\System32\inetsrv\config\applicationHost.config, the desired outcome looks like this:
I have a script that creates the variable:
Add-WebConfigurationProperty -pspath $IISPath -filter "system.webServer/rewrite/allowedServerVariables" -name "." -value @{name="RESPONSE_Server"}
So far, I can't figure out the way to do the same with xWebConfigProperty. This won't work:
I would need something of that sort:
Value = @{name="RESPONSE_Server"}
But there is no way to pass a hashtable into the Value parameter
The text was updated successfully, but these errors were encountered: