locked
Change a tag in Web.config RRS feed

  • Question

  • Dear All,

    I have a tag in my web.config file like this

    <compilation debug="true" targetFramework="4.5">

    I want to change the value from true to false. I have started to write the powershell script  but I am stuck

    $webConfig = '.\web.config'
    [xml]$web =  (Get-Content $webConfig)
    //I think the change script should go here. But I don't know what to write
    $web.Save($webConfig)

    Any help would be greatly appreciated.

    Tuesday, October 2, 2018 4:03 PM

All replies

  • $node = $web.SelectSingleNode('//compilation')
    $node.debug = 'false'


    \_(ツ)_/


    • Edited by jrv Tuesday, October 2, 2018 4:17 PM
    Tuesday, October 2, 2018 4:17 PM
  • You could also use IIS's appcmd to update it. 

    https://docs.microsoft.com/en-us/iis/get-started/getting-started-with-iis/getting-started-with-appcmdexe

    Tuesday, October 2, 2018 5:39 PM