Skip to content

Instantly share code, notes, and snippets.

@matt40k
Created February 21, 2016 19:39
Show Gist options
  • Save matt40k/7b2061b2c00d309f5f5b to your computer and use it in GitHub Desktop.
Save matt40k/7b2061b2c00d309f5f5b to your computer and use it in GitHub Desktop.
Update SSIS package prefixes
$dtsFiles = Get-ChildItem "C:\GIT\BusinessIntelligence\" -Filter *.dts -Recurse
Foreach($dtsFile in $dtsFiles)
{
Write-Host $dtsFile.FullName
$dtsContents = Get-Content $dtsFile.FullName
$dtsContents = $dtsContents -replace "SEQC_", "(SEQC) "
$dtsContents = $dtsContents -replace "SEQC - ", "(SEQC) "
$dtsContents = $dtsContents -replace "DFT_", "(DFT) "
$dtsContents = $dtsContents -replace "EXEC_", "(EXEC) "
$dtsContents = $dtsContents -replace "LKP_", "(LKP) "
$dtsContents = $dtsContents -replace "CNT_", "(CNT) "
$dtsContents = $dtsContents -replace "OLE_SRC_", "(OLE_SRC) "
$dtsContents = $dtsContents -replace "OLE_DST_", "(OLE_DST) "
$result = Set-Content $dtsFile.FullName $dtsContents -Encoding UTF8 # Need to set the encoding as PowerShell didn't honour the original and the (C) caused diff changes (and prob errors
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment