Add Nodes and Values to the sharepoint web.config file using powershell


hi ,

i add following text sharepoint web.config file using power shell.

i have tried of forum,however couldnt able find exact information

please me on this

above /system.webserver line add text::

  <httpprotocol>

      <customheaders>

        <clear />

        <add name="x-ua-compatible" value="ie=11" />

        <add name="x-frame-options" value="sameorigin" />

      </customheaders>

    </httpprotocol>

      </system.webserver>

regards,

bashaibm

     

hi jrv,

thank reply.

i new powershell.if possible please provide me entire script add text?

the text add under </system.webserver>

regards,

bashaibm


that not node spec closing tag node(element)

you need to say element parent.

you need use createdocumentf4agment create xml , use appendchild.

$f=$config.createdocumentfragment() $f.innerxml=@' <httpprotocol>     <customheaders>         <clear />         <add name="x-ua-compatible" value="ie=11" />         <add name="x-frame-options" value="sameorigin" />     </customheaders> </httpprotocol> '@ $config.configuration.appendchild($f)

if element name exists corrupt config file.


\_(ツ)_/



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Windows 2016 RDS event 1306 Connection Broker Client failed to redirect the user... Error: NULL