zoukankan      html  css  js  c++  java
  • EXEShell COM Librar

    Do you need execute a DOS command / batch file / exe from ASP? if yes, this EXEShell COM LIbrary will meet your requirement. ExeShell COM Library is a COM interface, it allows you to run an EXE application from current user account or a special user account, for example, you can run an EXE from Administrator user account to get higher privileges.
     
    ExeShell COM Library is a freeware, you can download it at here. [Download]
     
    For example,
    <%
        Set comEXEShell = Server.CreateObject("exeshell.shell")
        comEXEShell.RunCommandLine "Administrator", "123456", "C:\pdf2vec.exe C:\test.pdf C:\test.swf"
        Set comEXEShell = Nothing
    %>
     
    Remark:
    You may encounter Error 1314 in some Windows systems, please by following steps to solve this 1314 Error,

    ERROR 1314:
    ~~~~~~~~~~~~~
    1314 A required privilege is not held by the client. ERROR_PRIVILEGE_NOT_HELD 
    ~~~~~~~~~~~~~

    To resolve this issue:
    1. Click Start, click Run, type "secpol.msc", and then press ENTER. 
    2. Double-click "Local Policies". 
    3. Double-click "User Rights Assignment". 
    4. Double-click "Replace a process level token".
    5. Click "Add", and then double-click the "Everyone" group 
    6. Click "OK".
    7. You may have to logout or even reboot to have this change take effect.

    Please refer to following two screenshots to understand above steps,

     

     

    RunAs Command Line Tool (1)

    Lsrunas : free runas utility with password parameter (Freeware)

     Lsrunas.zip (22.80 KB).

    LSrunas can be used to run a command using another user account and passing the password as a parameter.
    This is a big improvement over the standard runas tool which is not able to accept a password.
    LSrunas can be used in scripts. 

    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.be" /runpath:c:\ 

    Some remarks:

    Works on Windows 2000 and higher
     

    RunAs Command Line Tool (2)

    CmdAsUser - start a command as a specified user. CmdAsUser command line is a freeware.

     CmdAsUser.zip (32.40 KB).

    Usage: CmdAsUser <user> <domain> [/p <password>] [/c <command>]

    Where:
    <user> is the name of the user.
    <domain> is the logon domain, specify a period '.' for local.
    <password> (optional) is the users password.
    <command> (optional) is the command line to execute as the specified
    user.

    Notes:
    If the password is not given then you will be prompted for it.
    If the command is not given then "cmd" is assumed.
    The calling process needs to either have administrative privileges (ie in the local adminstrators group) or at LEAST the following privileges:
        "Act as part of the operating system" (SeTcbPrivilege),
        "Bypass traverse checking" (SeChangeNotifyPrivilege),
        "Increase quotas" (SeIncreaseQuotaPrivilege),
        "Replace a process level token" (SeAssignPrimaryTokenPrivilege).
    The utility may take a while if there is inappropriate security so please be patient.

    Examples:

    CmdAsUser Martyn . /p GingerNinja /c regedit
    CmdAsUser test . /p 123 /c "C:\Program Files\docPrintPro v4.5\doc2pdf.exe" -i htttp://www.verypdf.com -o "C:\out.pdf"
     

    RunAs Command Line Tool (3)

    Use RunAs utility to execute a program from command line using a different user account.
    RunAs is command line utility that can be used to run a program under different user account. RunAs command line is a freeware.

    RunAs is similar to the Windows 2000/XP native RunAs utility, but it has some distinct features making it more usable then the native version:

    It accepts password as a command line parameter so that it can be used in batch files. 
    It can bind started process to the interactive user Desktop so it can be used to start interactive processes from various services.

     RunAs.zip (5.21 KB).

    Here is the help screen containing complete description and examples

    Usage: RunAs <user> <password> [/V] <program name>[parameters]

    Command line parameters:
     
    User Username in form DOMAIN\USER (for local accounts use .\USER format)
    Password Password for the user account
    /V Optional parameter. If specified binds the process to the interactive user Desktop. (Use this parameter when starting interactive programs from services)
    program name Name of the program file to launch. If the name includes spaces enclose the entire name in double quotes.
    parameters Optional command line parameters that you want to pass to the program.
     
    Run RunAs.exe without parameters from the DOS command prompt to see full description of the supported parameters.
     

    Free docPrint Service (4)

     docPrint_Service.zip (83.6 KB).
     
    docPrint Service can be used to run a Command Line from current active user account or a special user account, this tool is useful to overcome permission restrictions in SYSTEM and Non-Interactive user accounts.
     
    Please by following steps to use docPrint Service,
    1. Download docPrint_Service.zip and unzip it to a folder,
    2. Run docPrint_Service.exe application, you will see an icon appear in tray area,
    3. You can run following command lines to test it first, "docPrint_client.exe" will deliver the Command Line to docPrint_Service.exe application, docPrint_Service.exe application will execute the Command Line from active user account automatically,

    docPrint_client.exe nowait "C:\VeryDOC\pptconv.exe" C:\test.ppt C:\out.swf
    docPrint_client.exe wait "C:\VeryDOC\pptconv.exe" C:\test.ppt C:\out.swf
     
    4. You can call "docPrint_client.exe" from your code, please refer to a simple C# code at below,
     
    public partial class runpptexe : System.Web.UI.Page 
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Process proc = new Process();
            proc.StartInfo.FileName = "C:\\VeryDOC\\docPrint_client.exe";
            string strArguments = "wait C:\\VeryDOC\\pptconv.exe C:\\test.ppt C:\\test.swf";
            Console.WriteLine(strArguments);
            proc.StartInfo.Arguments = @strArguments;
            proc.Start();
            proc.WaitForExit();
            Response.Write("File has been successfully converted");
        }
    }
  • 相关阅读:
    经方膏方
    荆防柴朴汤
    温经汤治痤疮
    经方治疗带状疱疹
    用排除法诊断半表半里证
    leaflet 学习备忘
    在线数据库设计 初稿 想法简单验证
    SVG PATH 生成器
    模仿bootstrap做的 js tooltip (添加鼠标跟随功能)
    js 生成随机炫彩背景
  • 原文地址:https://www.cnblogs.com/mfryf/p/2424347.html
Copyright © 2011-2022 走看看