Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Invoke-Command with ; in script

$
0
0

Hi all,

im trying to run a SSIS package from Powershell using the Invoke-Command

all the examples i find to do this are calling files, were are we use packages stored in MSDB.

I have found the following links that im basing things on:
http://social.technet.microsoft.com/Forums/windowsserver/en-US/94a9402f-956d-4a4e-8a79-6c7acc3a4597/character-escaping-issue-running-dtexec-using-powershell-invokecommand

When i add my DTEXEC code i get the following error:

PS O:\> $sb_string = @’
DTEXEC.EXE /SQL “\”\Example\test\”" /SERVER “\”Server-SSIS\”" /CONNECTION “\”SQL.BI\”";”\”Data Source=PL-SQL;Initial Catalog=example;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;\”" /CHECKPOINTING OFF /REPORTING V
‘@
$sb = [scriptblock]::create($sb_string)
Exception calling “Create” with “1″ argument(s): “At line:1 char:101
+ … cumenter\”";”\”Data Source=PL-SQL;Initial Catalog=example;Provider=SQLNCLI11.1;I …
+ ~~~~
Unexpected token ‘Data’ in expression or statement.
At line:1 char:112
+ … ;”\”Data Source=PL-SQL;Initial Catalog=example;Provider=SQLNCLI11.1;Integrated S …
+ ~
The Data section is missing its statement block.

At line:4 char:1
+ $sb = [scriptblock]::create($sb_string)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ParseException

Really not sure where to go from here? any help or suggestions? It seems that im having the same sort of problem as the forum user, but where as the fix worked for him its not for me :( so i still have problem with “;”s and other Powershell related commands being seen in the script?

S


Viewing all articles
Browse latest Browse all 13067

Trending Articles