【发布时间】:2017-04-20 09:21:40
【问题描述】:
当我使用 PsExec 执行程序时,我测试 Internet 连接的方法不起作用。 它显示此消息:
“远程服务器返回错误:(403) Forbidden”**
我需要远程执行应用程序,这就是我使用 PsExec 的原因,但是当我不使用 PsExec 打开程序时,该方法运行正常。
我使用 PsExec 执行程序的命令:
"D:\PsExec.exe -s -i \\MK18455 D:\RemedyHealthCheck.exe "
方法:
Public Shared Function CheckForInternetConnection(link As String) As String
Try
Dim proxy As New WebProxy("ibproxy03.intranet.ibermatica:8080", True)
proxy.UseDefaultCredentials = True
Dim request As HttpWebRequest = WebRequest.Create(link)
request.Credentials = CredentialCache.DefaultCredentials
request.Proxy = proxy
Dim response As HttpWebResponse = request.GetResponse()
If response.StatusCode = HttpStatusCode.OK Then
Return "si"
Else
Return "no"
End If
Catch e As Exception
MsgBox(e.Message)
Return "no"
End Try
End Function
【问题讨论】:
-
定义“不工作”。有错误提示吗?
-
@AFriend 是的,它显示一条消息:“远程服务器返回错误:(403) Forbidden”
-
我看到您使用的是默认凭据。如果您尝试远程访问,则需要提供正确的凭据
-
@AFriend 例如?
-
@AFriend 因为我已经尝试使用我正在访问的计算机的用户名和密码
标签: vb.net windows command psexec