无法使用 PowerShell 中的 PsExec 运行 sqlplus
Unable to run sqlplus with PsExec from PowerShell
我无法使用 PowerShell 和 PsExec 运行 在远程计算机上进行 sqlplus 查询。
这是我的代码:
$psexec = "PsExec64.exe"
$computername = "server1"
$usr = "user"
$pwd = "password"
$command = "cmd /c"
$sqltool = "sqlplus.exe"
$parameters = "@echo select * from TEST.T1 where C1 = 1; | $sqltool -s / as sysdba"
& $psexec -accepteula \$computername -n 15 -u $usr -p $pwd $command $parameters | Out-Null
我收到错误消息:
PS C:\> & $psexec -accepteula \$computername -n 15 -u $usr -p $pwd $command $parameters | Out-Null
PsExec64.exe : The system cannot find the path specified.
At line:1 char:1
+ & $psexec -accepteula \$computername -n 15 -u $usr -p $pwd $command ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (The system cann...path specified.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
当我 运行 没有变量的命令时它工作正常:
PsExec64.exe -accepteula \server1 -n 15 -u user -p password cmd /c ("@echo select * from TEST.T1 where C1 = 1; | $sqltool -s / as sysdba")
有人可以帮我澄清一下这个问题吗?
这是我需要做的引述,以得到一些简单的 运行。
$psexec = 'PsExec64.exe'
$computername = 'HOST001'
$usr = "DOMAIN\username"
$pwd = "password"
$sqltool = "sqlplus.exe"
$parameters = "@echo select 'now' from DUAL; `| $sqltool -S dbuser/dbpass@DBHOST"
& "$psexec" -accepteula -nobanner \$computername -n 15 -u $usr -p $pwd cmd /c "$parameters"
我无法使用 PowerShell 和 PsExec 运行 在远程计算机上进行 sqlplus 查询。
这是我的代码:
$psexec = "PsExec64.exe"
$computername = "server1"
$usr = "user"
$pwd = "password"
$command = "cmd /c"
$sqltool = "sqlplus.exe"
$parameters = "@echo select * from TEST.T1 where C1 = 1; | $sqltool -s / as sysdba"
& $psexec -accepteula \$computername -n 15 -u $usr -p $pwd $command $parameters | Out-Null
我收到错误消息:
PS C:\> & $psexec -accepteula \$computername -n 15 -u $usr -p $pwd $command $parameters | Out-Null
PsExec64.exe : The system cannot find the path specified.
At line:1 char:1
+ & $psexec -accepteula \$computername -n 15 -u $usr -p $pwd $command ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (The system cann...path specified.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
当我 运行 没有变量的命令时它工作正常:
PsExec64.exe -accepteula \server1 -n 15 -u user -p password cmd /c ("@echo select * from TEST.T1 where C1 = 1; | $sqltool -s / as sysdba")
有人可以帮我澄清一下这个问题吗?
这是我需要做的引述,以得到一些简单的 运行。
$psexec = 'PsExec64.exe'
$computername = 'HOST001'
$usr = "DOMAIN\username"
$pwd = "password"
$sqltool = "sqlplus.exe"
$parameters = "@echo select 'now' from DUAL; `| $sqltool -S dbuser/dbpass@DBHOST"
& "$psexec" -accepteula -nobanner \$computername -n 15 -u $usr -p $pwd cmd /c "$parameters"