IIS WebAdministration - set physical path credentials locked

This topic contains 2 replies, has 2 voices, and was last updated by  Daniel Krebs 3 years, 8 months ago.

  • Author
  • #20144

    Scott Vierregger

    I am getting an error when I try to clear or set the IIS physical path credentials in Powershell 3 using the WebAdministration module. I want to be able to make the changes at the application level so I don't interfere with other applications or sites on the server. Specifying a PSPath and location doesn't seem to do anything.

    I assume I have to unlock the section, but the closest section I can find is Sites, and that is too coarse. I would appreciate the assistance if anybody knows exactly what to do in Powershell to manage the IIS physical path credentials (and all application-related settings) at the application level? I was looking for a command to create a location tag for my application, and then be able to specify that location tag for all my subsequent setting changes – but no joy.


  • #20147

    Daniel Krebs

    Hi Scott,

    I haven't found a way to apply the physical path credentials using the Set-WebConfiguration cmdlets but below works for me.

    Import-Module WebAdministration
    $SitePath = 'IIS:\Sites\Test'
    Set-ItemProperty -Path $SitePath -Name userName -Value 'DOMAIN\TestUser'
    Set-ItemProperty -Path $SitePath -Name password -Value 'Pa55word'


  • #20149

    Daniel Krebs

    I take back that I haven't found a way to use Set-WebConfiguration 🙂

    Set-WebConfiguration -Filter "/system.applicationHost/sites/site[@name='Test']/application[@path='/']/virtualDirectory[@path='/']" -Value @{userName='DOMAIN\TestUser'; password='Pa55word'}

    Please let me know if above works for you.


You must be logged in to reply to this topic.