关于ProcessStartInfo的问题
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim iProcess As New Process
Dim PassWord As New SecureString
PassWord = ConvertToSecureString("123")
iProcess.StartInfo.FileName = "\\192.168.1.1\Test\Test.exe"
iProcess.StartInfo.UserName = "aaa"
iProcess.StartInfo.Password = PassWord
iProcess.StartInfo.WorkingDirectory = "\\192.168.1.1\Test\"
iProcess.StartInfo.UseShellExecute = False
iProcess.StartInfo.CreateNoWindow = True
iProcess.StartInfo.RedirectStandardError = True
iProcess.StartInfo.RedirectStandardInput = True
iProcess.StartInfo.RedirectStandardOutput = True
iProcess.Start()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Function ConvertToSecureString(ByVal str As String) As SecureString
Dim password As New SecureString
For Each c As Char In str.ToCharArray
password.AppendChar(c)
Next
Return password
End Function
上面的程序一直提示用户名或者密码错误,可是远程的那台电脑上用户名密码就是这个啊。
另外我在本机电脑上新建了一个aaa的用户,密码为123 设置为“下次登录更改密码”上面的程序就会报需要更改密码,基本确定上面的StartInfo.UserName,StartInfo.Password只验证本地的账号,难道没有办法验证远程主机的账号吗?大家救救我吧
[解决办法]
不太了解。是不是要先执行以下net use,然后在访问远端的电脑?
[解决办法]
关注哦