function Set-XmlNodeValue { <# .SYNOPSIS Set web.config node. Depend on Set-AlkamiConfigs #> [CmdletBinding()] param( [Parameter(Mandatory=$true)][Xml]$doc, [string]$NodeString, [String]$AttributeName, [String]$AttributeValue ) $logLead = (Get-LogLeadName); $matchingNodes = $doc.SelectNodes($NodeString) if ($null -eq $matchingNodes -or $matchingNodes.Count -eq 0) { Write-Warning ("$logLead : Could not find node {0} in the supplied XML" -f $NodeString) } elseif ($matchingNodes.GetAttribute($AttributeName) -eq $AttributeValue) { Write-Host "$logLead : Node already has correct value '$AttributeValue'" $changed = $false } else { Write-Output ("$logLead : Updating Node '{0}' With Value '{1}'" -f $NodeString, $AttributeValue) $matchingNodes.SetAttribute($AttributeName,$AttributeValue) $changed = $true } Return $changed }