C#Remote Process用户名和密码不正确 [英] C# Remote Process username and password incorrect

查看:416
本文介绍了C#Remote Process用户名和密码不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我试图在我的局域网网络中获取远程计算机,我设置了所有属性,我知道用户名和密码但是当我尝试连接它时,请回复给我



System.ComponentModel.Win32Exception(0x80004005):用户名或密码不正确;



i输入正确的用户名和密码以及管理权限你觉得怎么样?



那是我的代码



Hello i'm try to get procceses to Remote Computer in my LAN network , i set all of the property good i know username and password but when i try to connect it give back to me

System.ComponentModel.Win32Exception (0x80004005): The user name or password is incorrect;

i type the right Username and Password with administrative rights what do u think ?

That is my code

const string file = "cmd.exe";

        var sspw = new SecureString();

        foreach (var c in "password")
            sspw.AppendChar(c);

        var proc = new Process();

        proc.StartInfo.UseShellExecute = false;

        proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(file);

        proc.StartInfo.FileName = Path.GetFileName(file);

        proc.StartInfo.Domain = "REMOTEPC";
        proc.StartInfo.Arguments = "";
        proc.StartInfo.UserName = "username";
        proc.StartInfo.Password = sspw;
        proc.StartInfo.LoadUserProfile = false;
        proc.Start();

推荐答案

该代码将尝试在你的来自远程计算机的本地用户帐户下的计算机。由于该帐户是其他计算机的本地帐户,因此它无法在您的计算机上运行。从描述来看,这不是你想要做的事情。



要在远程计算机上启动进程,你有几个选择:

That code will try to start a process on your computer under a local user account from the remote computer. Since the account is local to the other computer, it won't work on your computer. And from the description, that's not what you're trying to do anyway.

To launch a process on the remote computer, you have several options:
  • Use the Task Scheduler service, as described in this SO answer[^];
  • Use WMI, as described in this SO answer[^];
  • Use PsExec[^];


这篇关于C#Remote Process用户名和密码不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆