Skip to content

Instantly share code, notes, and snippets.

@bjh1977
Created April 15, 2020 09:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjh1977/c11b59b0801e867f0a695bf2b1086b5d to your computer and use it in GitHub Desktop.
Save bjh1977/c11b59b0801e867f0a695bf2b1086b5d to your computer and use it in GitHub Desktop.
# Point this at your SSIS project directory:
$SearchFolder = 'C:\Users\Joe.Bloggs\source\repos\SSIS_Test1\SSIS_Test1'
$Results = @()
Get-ChildItem $SearchFolder -Filter '*.dtsx' | ForEach-Object {
$FileContent = Get-Content $_.FullName -raw
$FileName = $_.BaseName
$FileContent -match "DTS:ObjectName=`".*`"" | Out-Null
$PackageObjectName = ($Matches[0]).Split('=')[1].Replace('"','')
$obj = $obj = New-Object -TypeName psobject
$obj | Add-Member -MemberType NoteProperty -Name FilePath -Value $_.FullName
$obj | Add-Member -MemberType NoteProperty -Name PackageObjectName -Value $PackageObjectName
if ($PackageObjectName -eq $FileName) {
Write-Verbose "Found '$FileName' in $($_.FullName)"
$Issue = $False
}
else {
Write-Verbose "File name is '$FileName' but package object name is $PackageObjectName"
$Issue = $True
}
$obj | Add-Member -MemberType NoteProperty -Name HasIssue -Value $Issue
$Results += $obj
}
Write-Output "FILES WHERE PACKAGE OBJECT NAME DIFFERS FROM FILE NAME:"
$Results | Where-Object {$_.HasIssue -eq $true}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment