Trying to script a call to dtexec.exe from Powershell.
I want to do something like: &'c:\windows\dtexec.exe'
But...the actual code to call dtexec in a command shell for instance
is:
dtexec /FILE "E:\SSIS\BBCSETL\CommonETL.dtsx" /MAXCONCURRENT " -1 " /
CHECKPOINTING OFF /REPORTING E /SET
"\Package.Variables[User::XMLQUERYB]";"2007-06-30T00:00:00" /SET
"\Package.Variables[User::XMLQUERYD]";"2007-05-01T00:00:00"
So, I need to use some set options, etc... I tried a couple of
different ways in powershell, but I kept getting random errors... How
does one call an exe from powershell and set switches, options, etc.?
dtexec.exe needs to be in the path or you need to specify it.
"SW" <Steve.S...@gmail.com> wrote in message
news:1187149239....@i38g2000prf.googlegroups.com...
dtexec /FILE E:\SSIS\BBCSETL\CommonETL.dtsx /MAXCONCURRENT -1 `
/CHECKPOINTING OFF /REPORTING E `
/SET '\Package.Variables[User::XMLQUERYB];2007-06-30T00:00:00' `
/SET '\Package.Variables[User::XMLQUERYD];2007-05-01T00:00:00'
and see if it works...
-bruce
--
Bruce Payette [MSFT]
Windows PowerShell Technical Lead
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
Visit the Windows PowerShell Team blog at:
http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at:
http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
My Book: http://manning.com/powershell
"SW" <Steve.S...@gmail.com> wrote in message
news:1187149239....@i38g2000prf.googlegroups.com...
Tried that. It appears to not like the '/SET' commands.
You must provide a value expression on the right-hand side of the '/'
operator.
At line:1 char:163
+ dtexec /FILE "E:\SSIS\BBCSETL\BaseBsnCommonServicesETL
\BaseBsnCommonServicesETL\CommonETL.dtsx" /SET
"\Package.Variables[User::XMLQUERYB]";"2006-08-31T00:00:00" /S <<<< ET
"\Package.Variables[User::XMLQUERYD]";"2006-07-01T00:00:00"
no workie.....
Invoke-Expression : You must provide a value expression on the right-
hand side of the '/' operator.
At line:1 char:18
+ invoke-expression <<<< $cmd
I've looked (almost) everywhere online for some samples of calling
native commands (dtexec) with command line arguments, etc.... not much
luck.
"\Package.Variables[User::XMLQUERYB]";"2006-08-31T00:00:00"
is parsed as three tokens:
"\Package.Variables[User::XMLQUERYB]" ; "2006-08-31T00:00:00"
You need to put the quotes around the *entire* phrase:
"\Package.Variables[User::XMLQUERYB];2006-08-31T00:00:00"
Note that there are no quotes immediately before and after the semicolon.
-bruce
--
Bruce Payette [MSFT]
Windows PowerShell Technical Lead
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
Visit the Windows PowerShell Team blog at:
http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at:
http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
My Book: http://manning.com/powershell
"SW" <Steve.S...@gmail.com> wrote in message
news:1187188225.7...@g4g2000hsf.googlegroups.com...
Thank you Bruce. That worked. Do you see any issue with me piping
the output of the dtexec call to a txt file?
By the way, can you digitally autograph my powershell book?
As a tip of debugging future problems of this nature, PowerShell Community
Extensions has a tool for this called echoargs.exe that will show you how
the target EXE will get the params from PowerShell. Just substitute echoarg
for the exe e.g.
58# echoargs /FILE "E:\SSIS\BBCSETL\CommonETL.dtsx" /MAXCONCURRENT " -1 "
CHECKPOINTING OFF /REPORTING E /SET "\Packag
e.Variables[User::XMLQUERYB];2007-06-30T00:00:00" /SET
"\Package.Variables[User::XMLQUERYD];2007-05-01T00:00:00"
Arg 0 is </FILE>
Arg 1 is <E:\SSIS\BBCSETL\CommonETL.dtsx>
Arg 2 is </MAXCONCURRENT>
Arg 3 is < -1 >
Arg 4 is <CHECKPOINTING>
Arg 5 is <OFF>
Arg 6 is </REPORTING>
Arg 7 is <E>
Arg 8 is </SET>
Arg 9 is <\Package.Variables[User::XMLQUERYB];2007-06-30T00:00:00>
Arg 10 is </SET>
Arg 11 is <\Package.Variables[User::XMLQUERYD];2007-05-01T00:00:00>
Of course it won't help with problems like the statement separator ( ; )
since that blows up in PowerShell before any args are ever passed to
echoargs.