I am trying to check if a specific node exists or does not like it.
There is a client in my configuration file called node, it may or may not be available.
If it is not available, I must add it.
$xmldata = [xml](Get-Content $webConfig) $xpath="//configuration/system.serviceModel" $FullSearchStr= Select-XML -XML $xmldata -XPath $xpath If ( $FullSearchStr -ne $null) { #Add client node $client = $xmldata.CreateElement('Client') $client.set_InnerXML("$ClientNode") $xmldata.configuration."system.serviceModel".AppendChild($client) $xmldata.Save($webConfig) }
The condition that I am checking can return an array.
I would like to check if the node client is available before or not?
Samselvaprabu
source share