by antonela at 2013-04-12 07:37:03
I have a powershell file (myFile.ps1) with this command (launch a dtexec):by Klaas at 2013-04-15 00:31:49
$TempFile="C:\Temp\a.xml"
dtexec /DTS "\MSDB\mydts" /SERVER localhost /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING V /set \package.variables[x_TempFile].Value;$TempFile
but I have this error:
Argument for ""package.variables[x_TempFile].Value"" for option "set" is not valid
Which is the correct way to set a variable (in my case the name of file)?
In a .cmd I use
set TempFile="C:\Temp\a.xml"
dtexec /DTS "\MSDB\mydts" /SERVER localhost /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING V /set \package.variables[x_TempFile].Value;%TempFile%
and it’s ok, but I’m not able to do the same in powershell.
I haven’t tried this, but sometimes parsing problems are overcome by constructing a string outside the cmd. Maybe something like this could work:by MaxTrinidad at 2013-04-16 11:38:05$pv = "\package.variables[x_TempFile].Value;'C:\Temp\a.xml'"
dtexec /DTS "\MSDB\mydts" /SERVER localhost /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING V /set $pv
I would recommend to use opening and closing single qoutes after the /set parameter including the semicolon ";".
$TempFile="C:\Temp\a.xml"
… /set ‘\package.variables[x_TempFile].Value;’+$TempFile
This will give the result which I think is what you’re looking for:
\package.variables[x_TempFile].Value;C:\Temp\a.xml
Hope this works for you.