我想从我的win7 CMD(如管理员)运行以下命令:
psexec IpAddress -u domain\user -p pword c:\Autobatch\ClientJobSender.exe http://reportserver.net:8070/JobExecutor.asmx c:\AutoBatch\backup\trigger.xml
但我得到一个“系统找不到指定文件”的错误。
我也试着这样说:
psexec IpAddress -u domain\user -p pword c:\Autobatch\ClientJobSender.exe http://reportserver.net:8070/JobExecutor.asmx c:\AutoBatch\backup\trigger.xml
却得到了一个未知的用户或密码错误。
什么奇怪的是,我可以通过远程桌面使用相同的IP地址和用户名/密码进行连接。
确保服务器具有以下设置:
a) Admin share is enabled: run services.msc and check the Service "Server" is enabled
b) Add the key for the share in the registry and restart:
reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v AutoShareServer /t REG_DWORD /d 1
然后使用:
psexec \\IpAddress -u domain\user -p pword -w "c:\Autobatch" "ClientJobSender.exe http://reportserver.net:8070/JobExecutor.asmx c:\AutoBatch\backup\trigger.xml"
其实,我没有看到你的2个命令行之间的差异。 然而,从第一个命令的错误是因为你的语法不正确。 您必须使用
PsExec \\a.b.c.d ...
代替
PsExec a.b.c.d ...
我把它通过提高当地的批处理文件,以管理员权限执行工作,也就是说,在终端窗口中以管理员权限运行。
如果你正在尝试使用自动化服务,您可以使用ClientJobSender.exe在本地机器上(或者你设置的调度上机)。 只需复制ClientJobSender.exe从安装包到服务器调度相关的配置文件,并在本地参考它。