无法从命令行向 runas 提供密码 [英] Unable to supply password to runas from commandline

查看:60
本文介绍了无法从命令行向 runas 提供密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法从命令行向 runas 提供密码

I am unable to supply password to runas from commandline

我已经尝试了以下

cmd /C echo my_admin_password | runas /user:DOMAINmy_admin_login c:	est.bat

echo my_admin_password | runas /user:DOMAINmy_admin_login c:	est.bat

我得到的错误是

正在尝试以用户DOMAINmy_admin_login"的身份启动 c: est.bat ...RUNAS 错误:无法运行 - c: est.bat1326: 登录失败:未知用户名或密码错误.

Attempting to start c: est.bat as user "DOMAINmy_admin_login" ... RUNAS ERROR: Unable to run - c: est.bat 1326: Logon failure: unknown user name or bad password.

我该如何解决这个问题?

How do I fix this?

推荐答案

看看这个链接:runas 实用程序

这是一个 runas 免费实用程序,具有以下功能:

It's a runas free utility that have the follwing features:

  1. 它接受密码作为命令行参数,以便在批处理文件中使用.

  1. It accepts password as a command line parameter so that it can be used in batch files.

它可以将启动的进程绑定到交互式用户桌面,因此它可以用于从各种服务(如 24x7 Scheduler、24x7 Event Server 等)启动交互式进程.

It can bind started process to the interactive user Desktop so it can be used to start interactive processes from various services such as 24x7 Scheduler, 24x7 Event Server and other.

注意:专业版的 RunAs 还支持对整个命令行进行加密,管理员可以使用它来让普通用户访问某些需要管理员级别权限的程序.用户不需要知道管理员的密码,也不能使用它来运行其他任何东西……对于这个常见问题的简单但非常有效的解决方案.

Note: Professional version of RunAs also supports encryption of the entire command line, which administrators can use to give regular users access to certain programs requiring admin-level privileges. Users don't need to know the administrator's password and cannot use it to run anything else… simple, yet very efficient solution for this common problem.

您也可以尝试使用 subprocess.Popen.communicate 甚至 subprocess.Popen.stdin.write 将密码作为进程的输入.

Also you can try pass the password as input for the process using subprocess.Popen.communicate or even subprocess.Popen.stdin.write.

其他有趣的链接:

如何将密码传递给进程?

带密码的命令行runas

PsExec

这篇关于无法从命令行向 runas 提供密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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