简体   繁体   English

在 LocalSystem C# 下运行的 RunAs

[英]RunAs running under LocalSystem C#

We are trying to execute a process, let's say "cmd.exe" under another username credentials.我们正在尝试执行一个进程,比如说另一个用户名凭据下的“cmd.exe”。 The application is running as a WCF service under LocalSystem account.该应用程序在 LocalSystem 帐户下作为 WCF 服务运行。 We have tried several methods(Process.start, CreateProcessWithLogOn, etc) and all seem to fail with "Access denied".我们尝试了几种方法(Process.start、CreateProcessWithLogOn 等),但似乎都以“拒绝访问”而失败。

Does anyone know how to do it?有谁知道该怎么做? Is there any way out there to do it?有没有办法做到这一点?

        var myProcess = new ProcessStartInfo(path)
            {
                UserName = username,
                Password = MakeSecureString(password),
                UseShellExecute = false, LoadUserProfile = true
            };

Tried setting UseShellExecute to false for the ProcessStartInfo ?尝试将ProcessStartInfoUseShellExecute设置为 false 吗? Or setting LoadUserProfile to false.或者将 LoadUserProfile 设置为 false。 Also your secure string maybe built incorrectly, did you try to use plain text password (temporarily, just to isolate the problem)?此外,您的安全字符串可能构建不正确,您是否尝试使用纯文本密码(暂时,只是为了隔离问题)? Does process start if you just use RunAs from command line?如果您只是从命令行使用 RunAs,进程是否会启动?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C#-使用Visual Studio安装项目安装时,在LocalSystem下运行的Windows Service提示输入凭据 - C# - Windows Service running under LocalSystem is prompting for credentials when installing using Visual Studio setup project 如何在本地系统帐户下禁止C#服务启动? - How to forbid C# service from start under LocalSystem account? Runas /NETONLY 来自 C# - Runas /NETONLY from C# 使用C#确定LocalSystem帐户名称 - Determine the LocalSystem account name using C# 以LocalSystem身份运行的.NET c#服务会更改注册表中的ProxyServer,但浏览器直到(重新)启动后才会注意到 - .NET c# service running as LocalSystem alters ProxyServer in registry, but browser's won't notice until (re)start LocalSystem Service如何以用户[C#]身份运行应用程序? - How a LocalSystem Service can run an application as a user [C#]? c# windows 库在 Linux 下运行 - c# windows library running under Linux 使用LocalSystem Service CreateProcessAsUser启动程序相当于登录时双击该图标? [C#] - Launching a program using LocalSystem Service CreateProcessAsUser equivalent to double-clicking on the icon when logged in? [C#] 如何使用 C# 检查 LocalSystem 帐户是否具有对特定本地目录的读/写权限? - How to check if LocalSystem account has read/write permissions to a specific local directory using C#? C#Sharepoint在鞭打代码运行下获取当前用户 - C# Sharepoint Get current user under whitch code running
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM