Mit Powershell-Skript und dtutil.exe Nutzen.
Zum Beispiel, Beispiel Quellcode, vielleicht mit allen Fehlern, von maxt2posh Blog (in anonymen Kommentar):
#get the location of DTUTIL
$DTSPath = (get-itemproperty -path “HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\100\SSIS\Setup\DTSPath”).’(default)’
#get the names of the packages in the current windows folder
$PackageNames = Get-ChildItem -Name -Filter “*.dtsx”
#The SSIS or Filesystem folder where the packages will be installed
$InstallTargetFolder = “”
#The SSIS or Filesystem folder where the existing packages will be backed up
$BackupFolder = “MattBKUP\”
function RUNINSTALL()
{
cls
Write-Host “.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^.^”
foreach ($name in $PackageNames )
{
InstallPackage $name.TrimEnd().ToString()
Write-Host “………………………………………………………….”
}
Write-Host ” ”
Write-Host ” ”
Write-Host “……………….DONE”
}
#copy all packages in the BackupFolder to the InstallFilder and delete the Backup Folder
#get the list of files in the $BackupFolder
#move them to the $InstallTargetFolder
function RollbackPackages {
Write-Host “ROLLING BACK…………………..”
foreach ($name in $PackageNames )
{
Write-Host “ROLLING BACK PACKAGE ” + $Name
[String]$From = $BackupFolder + $Name.Replace(“.dtsx”,”")
[String]$To = “SQL;” + $InstallTargetFolder + $Name.Replace(“.dtsx”,”")
Write-Host “Restoring PACKAGE From:” + $From + ” TO:” + $To
[String]$Status = dtutil /SQL $From /MOVE $To /quiet
}
}
#Move the Package $Name From $InstallTargetFolder to $BackupFolder
function BackupPackage { param( [String]$Name, [String]$Status )
[String]$From = $InstallTargetFolder + $Name.Replace(“.dtsx”,”")
[String]$To = “SQL;” + $BackupFolder + $Name.Replace(“.dtsx”,”").ToString()
[String]$ToPath = “SQL;” + $BackupFolder
#package exists?
[String]$PackageExists = dtutil /SQL $From /Ex /quiet
if($PackageExists.Contains(“The specified package exists”) )
{
#backup folder exists?
[String]$FolderExists = dtutil /Fe $ToPath /quiet
if($FolderExists.Contains(“The specified folder does not exist”) )
{
[String]$CreatePath = “SQL;\;” + $BackupFolder.TrimEnd(‘\’)
Write-Host “Creating Backup folder:” $CreatePath
#/FC[reate] {SQL | DTS};ParentFolderPath;NewFolderName
[String]$Status = dtutil /FC $CreatePath /quiet
}
Write-Host “BACKING UP PACKAGE From:” $From ” TO:” $To
[String]$Status = dtutil /SQL $From /COPY $To /quiet
}
else
{Write-Host “Backup not required for:” $From}
}
function ValidateInstall {
param([String]$Name,[String]$Status)
if ( $LASTEXITCODE -eq 0)
{
Write-Host “Package Deployment Success ” $Name
}
else
{
if
( $LASTEXITCODE -eq 1) {Write-Host “Package Deployment Failed ” + $Name + ” …*** ERROR *** The utility failed. Error code 1 ” + $status }
elseif
($LASTEXITCODE -eq 4) {Write-Host “Package Deployment Failed ” + $Name + ” …*** ERROR *** The utility cannot locate the requested package. Error code 4 ” + $status }
elseif
($LASTEXITCODE -gt 5) {Write-Host “Package Deployment Failed ” + $Name + ” …*** ERROR *** The utility cannot load the requested package. Error code 5 ” + $status }
elseif
($LASTEXITCODE -gt 6) {Write-Host “Package Deployment Failed ” + $Name + ” …*** ERROR *** The utility cannot resolve the command line because it contains either syntactic or semantic errors. Error code 6 ” + $status }
else
{“Package Deployment Failed ” + $Name + ” …*** ERROR *** Unidentified Error. ” + $status }
RollbackPackages
Write-Host ” ”
Write-Host “ROLLBACK COMPLETE”
Write-Host ” ”
Read-Host “Press enter to continue …”
Exit
}
}
function InstallPackage { param( [String]$Name, [String]$Status )
backuppackage $Name $Status
[String]$To = “SQL;” + $InstallTargetFolder + $Name.Replace(“.dtsx”,”")
$Status = dtutil /FILE $Name /COPY $To /quiet
ValidateInstall $Name $Status
}
Referenzen:
Drehbuch von Chad Miller
http://maxt2posh.wordpress.com/2010/04/23/deploying-ssis-packages-using-dtutil-exe-with-powershell-part-1%E2%80%A6/
http://billfellows.blogspot.com.es/2010/05/powershell-dtutil-ssisdeploymanifest.html
dtutil Dienstprogramm
Sql PSX
http://www.katieandemil.com/powershell-dtutil
1 Stimmen
Gibt es eine endgültige Lösung oder eine endgültige Schlussfolgerung?