Modifying a web.config file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
.
.
.
  <microsoft.identityModel>
    <service saveBootstrapTokens="true">
      <audienceUris>
        <add value="https://server01.mydomain.com/myApp"/>
      </audienceUris>
      <federatedAuthentication>
        <wsFederation passiveRedirectEnabled="true" issuer="https://server01.mydomain.com/STS/issue/wsfed" realm="https://server01.mydomain.com/myApp" requireHttps="true"/>
        <cookieHandler requireSsl="true" domain=""/>
      </federatedAuthentication>
.
.
.

</configuration>

I have the following web.config file and I want to modify the server name. I started with this and although it modified the server name I received the following error message.

$webConfig = 'C:\Scripts\Web.config'
$doc = (Get-Content $webConfig) -as [Xml]
$obj = $doc.microsoft.identityModel.service.audienceUris.add
$obj.value = 'https://server02.mydomain.com/myApp'

$doc.Save($webConfig)

The property 'value' cannot be found on this object. Verify that the property exists and can be set.

At line:7 char:1

+ $obj.value = 'https://server02.mydomain.com/myApp'

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : PropertyNotFound

Could someone help with this and is there an easier way to change the next two references to the server name?

Thanks for any help.

September 1st, 2015 1:34pm

$webConfig = 'C:\Scripts\Web.config'
$doc=[xml](Get-Content $webConfig)
$node=$doc.SelectSingleNode('//microsoft.identityModel/service/audienceUris/add')
$node.value='https://server02.mydomain.com/myApp'
$doc.Save($webConfig)		
Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 1:52pm

Thanks
September 1st, 2015 4:10pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics