appending node to xml file with powershell
  I have a routine in powershell that queries the index usage stats.  The query runs for each database on the server and pumps out an xml snippet.  I'm trying to get all of the results in one xml file.  All of the code works except for the piece that appends nodes to an existing xml file.  I've tried AppendNode and ImportNode with no results.  Here's the snippet that isn't working

    $xml = Invoke-Sqlcmd -Query... | ConvertTo-Xml

    $file_xml = [xml](Get-Content $target_file)	
    $index_nodes = $xml.SelectNodes("/Objects/Object")	
    foreach($index_node in $index_nodes){
        $file_xml.ImportNode($index_node, $true)			
    }				
    $file_xml.Save($target_file)

appending node to xml file with powershell
===

  I have a routine in powershell that queries the index usage stats.  The query runs for each database on the server and pumps out an xml snippet.  I'm trying to get all of the results in one xml file.  All of the code works except for the piece that appends nodes to an existing xml file.  I've tried AppendNode and ImportNode with no results.  Here's the snippet that isn't working

    $xml = Invoke-Sqlcmd -Query... | ConvertTo-Xml

    $file_xml = [xml](Get-Content $target_file)	
    $index_nodes = $xml.SelectNodes("/Objects/Object")	
    foreach($index_node in $index_nodes){
        $file_xml.ImportNode($index_node, $true)			
    }				
    $file_xml.Save($target_file)
