Created
March 29, 2016 05:41
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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