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

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

问题描述

我无法从命令行提供密码以运行方式

I am unable to supply password to runas from commandline

我尝试了以下

cmd /C echo my_admin_password | runas /user:DOMAIN\my_admin_login c:\test.bat

echo my_admin_password | runas /user:DOMAIN\my_admin_login c:\test.bat

我得到的错误是

尝试以用户"DOMAIN \ my_admin_login"启动c:\ test.bat ... RUNAS错误:无法运行-c:\ test.bat 1326:登录失败:未知的用户名或错误的密码.

Attempting to start c:\test.bat as user "DOMAIN\my_admin_login" ... RUNAS ERROR: Unable to run - c:\test.bat 1326: Logon failure: unknown user name or bad password.

我该如何解决?

推荐答案

看看此链接:这是一个免费的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天全站免登陆