Skip to content

Instantly share code, notes, and snippets.

@Fabian-Schmidt
Created March 29, 2016 05:41
Show Gist options
  • Save Fabian-Schmidt/71746e8e1dbdf9db9278 to your computer and use it in GitHub Desktop.
Save Fabian-Schmidt/71746e8e1dbdf9db9278 to your computer and use it in GitHub Desktop.
Extract all images from all SSRS (Sql Server Reporting Serivces) Reports (*.RDL file) in the current folder.
$ErrorActionPreference = 'Stop';
Get-ChildItem -Filter '*.rdl' | ForEach {
$reportFile = $_;
Write-Host $reportFile;
$report = [xml](Get-Content $reportFile);
$report.Report.EmbeddedImages.EmbeddedImage | Foreach {
$imagexml = $_;
$imageextension = $imagexml.MIMEType.Split('/')[1];
$filename = $imagexml.Name + '.' + $imageextension;
Write-Host '->' $filename;
$imageContent = [System.Convert]::FromBase64String($imagexml.ImageData);
Set-Content -Path $filename -Encoding Byte -Value $imageContent;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment