Created
April 15, 2020 09:53
-
-
Save bjh1977/c11b59b0801e867f0a695bf2b1086b5d to your computer and use it in GitHub Desktop.
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
# 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