SSRS RDL File Command Text


/ Published in: Windows PowerShell
Save to your folder(s)



Copy this code and paste it in your HTML
  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{$_.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{$_.Query.CommandText + "|"| add-content $dest}
  20. }
  21.  
  22. #Returns the output.
  23. get-content $dest

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.