Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
术语';执行官';未识别为cmdlet Powershell的名称_Powershell_Ssis_Dtexec - Fatal编程技术网

术语';执行官';未识别为cmdlet Powershell的名称

术语';执行官';未识别为cmdlet Powershell的名称,powershell,ssis,dtexec,Powershell,Ssis,Dtexec,我有一个SSIS dtsx包,我想使用PowerShell运行它。下面是我在powershell中运行的内容 EXEC xp\u cmdshell“C:\Program Files\Microsoft SQL Server\130\DTS\Binn\DTExec.exe”/f“f:\SqlExport\New package.dtsx” 不幸的是,我得到下面的错误,我不知道为什么 EXEC : The term 'EXEC' is not recognized as the name of a

我有一个SSIS dtsx包,我想使用PowerShell运行它。下面是我在powershell中运行的内容

EXEC xp\u cmdshell“C:\Program Files\Microsoft SQL Server\130\DTS\Binn\DTExec.exe”/f“f:\SqlExport\New package.dtsx”
不幸的是,我得到下面的错误,我不知道为什么

EXEC : The term 'EXEC' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + EXEC xp_cmdshell '"C:\Program Files\Microsoft SQL Server\130\DTS\Binn ... + ~~~~ + CategoryInfo : ObjectNotFound: (EXEC:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException EXEC:术语“EXEC”不能识别为cmdlet、函数、, 脚本文件或可操作程序。检查名称的拼写,或者检查路径是否正确 已包括,请验证路径是否正确,然后重试。 第1行字符:1 +EXEC xp_cmdshell的“C:\Program Files\Microsoft SQL Server\130\DTS\Binn…”。。。 + ~~~~ +CategoryInfo:ObjectNotFound:(EXEC:String)[],CommandNotFoundException +FullyQualifiedErrorId:CommandNotFoundException
我已经使用下面的命令在SQL Server中启用了
xp\u cmdshell
EXEC xp\u cmdshell
是通过
cmd.exe
启动shell命令的工具

我认为其目的是让PowerShell执行以可执行路径“C:\Program Files\Microsoft SQL Server\130\DTS\Binn\DTExec.exe”开头的命令,该命令通过
EXEC xp\u cmdshell从T-SQL脚本启动

相反,您的错误消息意味着PowerShell执行了整行程序,这可能会失败:PowerShell没有
EXEC
命令(并且您的系统上没有该名称的外部程序)

也就是说,如果SQL Server(通过T-SQL脚本)执行了您的
EXEC xp_cmdshell
行,则此处不需要PowerShell,也不会进入图片

事实上,如果SQL Server正确执行,您的T-SQL命令应该按原样工作(通过
cmd.exe
调用带有参数的外部程序)


[1] 更新:如果目的只是从PowerShell启动命令

请注意,
&
,调用操作符需要告诉PowerShell后面的双引号字符串是要调用的可执行文件的名称

& "C:\Program Files\Microsoft SQL Server\130\DTS\Binn\DTExec.exe" /f "F:\SqlExport\New package.dtsx"`