« Previous Next »

Thread: How do you unlock configuration data using the IIS Powershell snapin.

Last post 05-15-2009 12:45 AM by sergeia. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 04-12-2009, 9:20 PM

    How do you unlock configuration data using the IIS Powershell snapin.

    I want to be able to unlock some sections in particular the module, security among others

     This is the XML data I'd like to be able to set using the cmdlets

     <section name="modules" allowDefinition="MachineToWebRoot" overrideModeDefault="Allow" />

    This works with Set/Get-WebConfigurationProperty
    (Get-WebConfiguration -filter /system.webServer/directoryBrowse).enabled
    Get-WebConfigurationProperty -filter /system.webServer/directoryBrowse -name enabled

    But neither of these do

    Get-WebConfigurationProperty -filter /system.webServer/modules -name OverrideMode

    Set-WebConfigurationProperty -filter /system.webServer/modules -name OverrideMode -value $false

    The error I get back is
    WARNING: Property OverrideMode is not found on  /system.webServer/modules.

    This property is there I can see using either of these methods

    Get-WebConfiguration -Filter /system.webServer/modules | fl *
    (Get-WebConfiguration -Filter /system.webServer/modules).OverrideMode

    I'm having similar difficulties modifying the Security and other sections

    Is this a bug? Please let me know what I'm doing wrong and how I can set these

    thx

    bob 

     

  • 05-15-2009, 12:45 AM In reply to

    • sergeia
    • Top 100 Contributor
    • Joined on 04-14-2008, 4:47 PM
    • Posts 68

    Re: How do you unlock configuration data using the IIS Powershell snapin.

    It is quite confusing, indeed. OverrideMode is metadata on sections, we expose it as property in cmdlets, but it is actually read-only. To remove lock from the section you need to target metadata:

     set-webconfiguration //asp machine/webroot/apphost -metadata overrideMode -value Allow

    use path to your place instead of 'machine/webroot/apphost'. Use name of your section instead of 'asp'. Metadata is a switch in get-webconfigurationproperty, that adds s.Metadata member to section object 's', and it takes name of metadata that you want to change in set-webconfiguration.

    PS IIS:\Sites\testSite\bar #> (get-webconfiguration //asp -metadata).Metadata


    overrideMode                 : Allow
    ... rest of metadata ...

     

    Thanks for bringing it to our attention,

    Sergei 

     

Page 1 of 1 (2 items)
Microsoft Communities