Skip to content

Commit b9e5089

Browse files
author
Ajay Dwivedi
committed
Modified multiple scripts
Modified multiple scripts
1 parent 7696252 commit b9e5089

File tree

7 files changed

+469
-269
lines changed

7 files changed

+469
-269
lines changed
4.5 KB
Binary file not shown.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,20 @@
11
https://sqlrambling.net/2016/12/01/ssisdb-and-catalog-part-3-copying-a-package-between-servers/
22

3+
Param($SQLInstance = "SourceSqlInstance")
4+
add-pssnapin sqlserverprovidersnapin100 -ErrorAction SilentlyContinue
5+
add-pssnapin sqlservercmdletsnapin100 -ErrorAction SilentlyContinue
6+
cls
7+
$Packages = Invoke-Sqlcmd -MaxCharLength 10000000 -ServerInstance $SQLInstance -Query "select p.name, CAST(CAST(packagedata AS VARBINARY(MAX)) AS VARCHAR(MAX)) as pkg
8+
FROM MSDB..sysssispackages p join
9+
msdb..sysssispackagefolders f on p.folderid = f.folderid
10+
where f.foldername NOT LIKE 'Data Collector%'"
11+
Foreach ($pkg in $Packages)
12+
{
13+
$pkgName = $Pkg.name
14+
$fullfolderPath = "C:\Users\jsytniak\Documents\SSIS_Packages_DBA\$pkgName\"
15+
if(!(test-path -path $fullfolderPath))
16+
{
17+
mkdir $fullfolderPath | Out-Null
18+
}
19+
$pkg.pkg | Out-File -Force -encoding ascii -FilePath "$fullfolderPath\$pkgName.dtsx"
20+
}

0 commit comments

Comments
 (0)