vb 服务器无响应,无法使用c#Asp.Net在远程服务器上运行VB脚本

我正在尝试在从Web门户导入的远程服务器上运行DelTemp-Final.vbs。

我尝试使用原生C#来完成任务,没有运气。所以我选择PS工具来帮助我。我坚持下面的情景。请帮忙

Psexec正在使用命令提示符,但不使用c#

下面是命令提示输出,它正常工作:

C:\inetpub\wwwroot\DelTemp\Scripts>psexec \\testusit1 -u XXXX\xxxxxxx -p xxxx

Xxxxxxxx -accepteula -i 0 -d c:\windows\system32\cscript.exe /nologo "\\testusi

t2\C$\karthik\DelTemp-Final.vbs"

PsExec v2.11 - Execute processes remotely

Copyright (C) 2001-2014 Mark Russinovich

Sysinternals - www.sysinternals.com

c:\windows\system32\cscript.exe started on testusit1 with process ID 5452.

C:\inetpub\wwwroot\DelTemp\Scripts>psexec \\testusit2 -u XXXX\xxxxxxx -p xxxxx

xxxxxxxxx -accepteula -i 0 -d c:\windows\system32\cscript.exe /nologo "\\testusi

t2\C$\karthik\DelTemp-Final.vbs"

PsExec v2.11 - Execute processes remotely

Copyright (C) 2001-2014 Mark Russinovich

Sysinternals - www.sysinternals.com

c:\windows\system32\cscript.exe started on testusit2 with process ID 7416.

然而,当在asp.net中包含c#时,相同的命令不起作用

Process p=new Process();

p.StartInfo.UseShellExecute=false;

p.StartInfo.RedirectStandardOutput=true;

p.StartInfo.RedirectStandardError=true;

p.StartInfo.RedirectStandardInput=true;

p.StartInfo.FileName=@"C:\inetpub\wwwroot\DelTemp\Scripts\PsExec.exe";

p.StartInfo.Arguments="\\\\"+li.Text+" -u XXXX\\xxxxxx -p xxxxxxxxxxx -accepteula -i 0 -d c:\\windows\\system32\\cscript.exe /nologo \\\\testusit2\\C$\\karthik\\DelTemp-Final.vbs";

p.Start();

string output=p.StandardOutput.ReadToEnd();

string errormessage=p.StandardError.ReadToEnd();

p.WaitForExit();

txtValueA.Text +="PSexec argument :" + p.StartInfo.Arguments;

txtValueA.Text +="
Output : " + output+"| error messsage: "+errormessage;

两台服务器的上述代码输出如下:

PSexec argument :\\testusit1 -u XXXX\xxxxxxxxxx -p xxxxxxxxxx -accepteula -i 0 -d

c:\windows\system32\cscript.exe /nologo \\testusit2\C$\karthik\DelTemp-Final.vbs Output : | error

messsage: PsExec v2.11 - Execute processes remotely Copyright (C) 2001-2014 Mark Russinovich

Sysinternals - www.sysinternals.com The handle is invalid. Connecting to testusit1... Starting

PSEXESVC service on testusit1... Connecting with PsExec service on testusit1... Error deriving

session key:

PSexec argument :\\testusit2 -u XXXX\xxxxxxxxxxx-p xxxxxxxxxx -accepteula -i 0 -d

c:\windows\system32\cscript.exe /nologo \\testusit2\C$\karthik\DelTemp-Final.vbs Output : | error

messsage: PsExec v2.11 - Execute processes remotely Copyright (C) 2001-2014 Mark Russinovich

Sysinternals - www.sysinternals.com Access is denied. Connecting to testusit2... Starting PSEXESVC

service on testusit2... Could not start PSEXESVC service on testusit2: Connecting to testusit2...

Starting PSEXESVC service on testusit2...

请帮助..我需要对脚本进行任何更改吗?非常感谢任何帮助。

提前多多感谢:)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值