zoukankan      html  css  js  c++  java
  • 可以自动输入密码的Runas

    一 Runas

    在使用批处理实现自动化的工程中,我们也许会遇到某些操作必须要在拥有权限的某个用户下才能执行。但是这时windows自带的Runas在批处理中调用时不能完成自动输入密码。 这时需要使用免费的第三方工具:

    1)lsrunas (http://www.moernaut.com/default.aspx?item=lsrunas

    LSrunas can be used to run a command using another user account and passing the password as a parameter

    Parameters:
    -----------
      /user:          specifies the username
      /password:      specifies the password
      /domain:        specifies the domain
      /command:       specifies the command to execute and the parameters
      /runpath:       specifies the path where the command should start

    Examples:
    ---------
    lsrunas /user:administrator /password:s3cr3tp@ssw0rd /domain:Mydomain /command:notepad.exe /runpath:c:\

    lsrunas /user:administrator /password:s3cr3tp@ssw0rd /domain:Mydomain /command:"C:\Program Files\Internet Explorer\iexplore.exe" /runpath:c:\

    lsrunas /user:administrator /password:s3cr3tp@ssw0rd /domain:Mydomain /command:"C:\Program Files\Internet Explorer\iexplore.exe http://www.google.cn" /runpath:c:\

    2)sanur (http://www.commandline.co.uk/sanur_unsupported/index.html

    Sanur is a tiny Win32 console utility that 'pipes' a password into the Windows 2000/XP/2003 Runas utility, thereby making Runas scriptable.

    Usage
    Pipe your normal Runas commandline into Sanur and specify the password on Sanur's commandline or use the /i switch to have Sanur read the password from a file:-

    RUNAS <options> | SANUR password
    RUNAS <options> | SANUR /i [drive:][path]filename

    In otherwords, just add  | SANUR password  to the end of your working Runas command.

    Examples
    Pipe the password 'pa55w0rd' into Runas:
    runas /u:domain\username program.exe | sanur pa55w0rd

    Pipe the password from the file named password.txt into Runas:
    runas /u:domain\username program.exe | sanur /i password.txt

    Same as above but any Runas errors, such as a logon failure, will be displayed:
    runas /u:domain\username program.exe >&2 | sanur /i password.txt

    二使用shellrunas来为windows增加右键使用不同的用户来运行程序。

    SysinternalsSuite-ShellRunas - Launch programs as a different user via a convenient shell context-menu entry.
     

    完!


    作者:iTech
    微信公众号: cicdops
    出处:http://itech.cnblogs.com/
    github:https://github.com/cicdops/cicdops

  • 相关阅读:
    后缀数组/LCP
    Manachar's Algorithm
    自动AC机qwq(大雾)以及trie图fail图的一些结论
    平衡树有关题目小结
    洛谷日报索引(转)
    初始化函数的简单写法
    关于对拍
    第12组 Alpha冲刺(4/6)
    第12组 Alpha冲刺(3/6)
    第12组 Alpha冲刺(2/6)
  • 原文地址:https://www.cnblogs.com/itech/p/1784064.html
Copyright © 2011-2022 走看看