Advertisement
nottyheadedboss

Get-RDLMetadata v0.01

Jun 3rd, 2025
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PowerShell 1.15 KB | Source Code | 0 0
  1. # Define the folder containing the RDL files
  2. $rdlFolder = "C:\Path\To\RDLFiles"
  3.  
  4. # Loop through all RDL files in the folder
  5. Get-ChildItem -Path $rdlFolder -Filter *.rdl | ForEach-Object {
  6.     $rdlFile = $_.FullName
  7.     Write-Host "`nProcessing: $($_.Name)" -ForegroundColor Cyan
  8.  
  9.     try {
  10.         # Load the XML content
  11.         [xml]$xml = Get-Content $rdlFile
  12.  
  13.         # Extract metadata
  14.         $reportName = $_.BaseName
  15.         $description = $xml.Report.Description
  16.         $dataSources = $xml.Report.DataSources.DataSource.Name
  17.         $datasets = $xml.Report.DataSets.DataSet.Name
  18.         $parameters = $xml.Report.ReportParameters.ReportParameter | ForEach-Object { $_.Name }
  19.  
  20.         # Display extracted metadata
  21.         Write-Host "Report Name     : $reportName"
  22.         Write-Host "Description     : $description"
  23.         Write-Host "Data Sources    : $($dataSources -join ', ')"
  24.         Write-Host "Datasets        : $($datasets -join ', ')"
  25.         Write-Host "Report Parameters: $($parameters -join ', ')"
  26.     }
  27.     catch {
  28.         Write-Host "Failed to parse $rdlFile" -ForegroundColor Red
  29.         Write-Host $_.Exception.Message
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement