Posted By

michanne on 05/11/11


Tagged

ssrs


Versions (?)

SSRS RDL File Command Text


 / Published in: Windows PowerShell
 

  1. $path = 'C:\SQL'
  2. #cd $path
  3. $dest = "$path\rptdependencies.txt"
  4.  
  5. @($a)
  6. #Gets a list of all rdl files in the directory.
  7. $files = dir | select Name | where{$_\3.Name -like "*.rdl"}
  8.  
  9. #writes the path to a file.
  10. set-content $dest -value $path
  11.  
  12. foreach($file in $files) {
  13. $xml = [xml](get-content $file.Name)
  14.  
  15. #prints a line for the name of the file.
  16. add-content $dest $file.name
  17.  
  18. #prints a line for each command text entry in the file. See RDL schema for other fields.
  19. $xml.Report.DataSets.DataSet |foreach{$_\3.Query.CommandText + "|"| add-content $dest}
  20. }
  21.  
  22. #Returns the output.
  23. get-content $dest

Report this snippet  

You need to login to post a comment.