Quantcast
Channel: SQLServerCentral » Programming » Powershell » Latest topics
Viewing all articles
Browse latest Browse all 467

Run DTEXEC from Powershell - convert from batch file

$
0
0
I have the following dtexec command that works fine in a cmd batch file:dtexec /f %DTSPackagesDir%"\%SSISJob%" /Decrypt %DTSPassword% /CONN cm_sql_USTG;%cm_sql_USTG% /Reporting E /Set \Package.Variables[User::strDestinationFolderForFlatFile].Value;%TargetDir%\ /Set \Package.Variables[User::strExtractType].Value;%ExtractType% /Set \Package.Variables[User::strDayKey].Value;%ProcDate%I tried converting it for Powershell and ended up with this:dtexec /f "$cfgDTSPackagesDir\$DTSPackageName /Decrypt $cfgDTSPassword /CONN cm_sql_USTG;$cm_sql_USTG /Reporting E /Set \Package.Variables[User::strDestinationFolderForFlatFile].Value;$TargetDir\ /Set \Package.Variables[User::strExtractType].Value;$ExtractType /Set \Package.Variables[User::strDayKey].Value;$DayKey"The connection string is:Set-Variable -name cm_sql_ustg "Data Source=$cfgDBServer;Initial Catalog=$cfgDBName;Provider=SQLNCLI10.1;Integrated Security=SSPI;Auto Translate=False;Application Name=$AppName"; Write-Output "Connection String cm_sql_ustg: $cm_sql_ustg"I am either getting that the "system cannot find the file specified" and I know it is there, or if I make some changes, it stops on the connection string, not recognizing "Source" (as part of the "Data Source ...." string.Thanks for any help.

Viewing all articles
Browse latest Browse all 467

Trending Articles