1. Welcome Guest! In order to create a new topic or reply to an existing one, you must register first. It is easy and free. Click here to sign up now!.
    Dismiss Notice

Running a batch file

Discussion in 'Windows Security' started by Timbo, Sep 25, 2009.

  1. Timbo

    Timbo Guest

    Please, please can some one help me...

    I am trying to run a batch file in vista as an administrator. I know I can
    use the RUNAS command, but this prompts me for a password. (and what
    password is a mystery to me as it's a non domain machine and there isn't a
    user called administrator, but that's besides the point). What I am
    looking to do is to replicate the behaviour of Right Clicking on the batch
    file and clicking 'Run as administrator', then the security box comes up -
    this is fine, that is EXACTLY what I want to happen. The user already has
    adminitrator privilages and I understand that I'll never get around the
    security box coming up - I don't mind this, but I can't seem to find a way
    of replicating this.

    Any ideas will be greatfully received.

    Thanks

    Tim
     
  2. Peter Foldes

    Peter Foldes Guest

    Timbo

    You are using OE to post here. Is that the machine in question or is it a Vista Home
    which cannot accomplish what you are asking

    --
    Peter

    Please Reply to Newsgroup for the benefit of others
    Requests for assistance by email can not and will not be acknowledged.

    "Timbo" <me@home.com> wrote in message news:OUTluRfPKHA.1232@TK2MSFTNGP05.phx.gbl...<!--coloro:blue--><span style="color:blue <!--/coloro-->
    > Please, please can some one help me...
    >
    > I am trying to run a batch file in vista as an administrator. I know I can use
    > the RUNAS command, but this prompts me for a password. (and what password is a
    > mystery to me as it's a non domain machine and there isn't a user called
    > administrator, but that's besides the point). What I am looking to do is to
    > replicate the behaviour of Right Clicking on the batch file and clicking 'Run as
    > administrator', then the security box comes up - this is fine, that is EXACTLY
    > what I want to happen. The user already has adminitrator privilages and I
    > understand that I'll never get around the security box coming up - I don't mind
    > this, but I can't seem to find a way of replicating this.
    >
    > Any ideas will be greatfully received.
    >
    > Thanks
    >
    > Tim
    > <!--colorc--><!--/colorc-->
     
  3. Timbo wrote:<!--coloro:blue--><span style="color:blue <!--/coloro-->
    > Please, please can some one help me...
    >
    > I am trying to run a batch file in vista as an administrator. I know I can
    > use the RUNAS command, but this prompts me for a password. (and what
    > password is a mystery to me ....<!--colorc--><!--/colorc-->


    It's the username/password for whatever account with local
    administrative privileges that you wish to use to run the batch file.

    <!--coloro:blue--><span style="color:blue <!--/coloro-->
    >.... as it's a non domain machine....<!--colorc--><!--/colorc-->


    Not relevant.

    <!--coloro:blue--><span style="color:blue <!--/coloro-->
    > and there isn't a
    > user called administrator,<!--colorc--><!--/colorc-->

    Of course, there is. However, by default in Vista, the Built-in
    Administrator account is disabled.

    <!--coloro:blue--><span style="color:blue <!--/coloro-->
    > .... but that's besides the point). What I am
    > looking to do is to replicate the behaviour of Right Clicking on the batch
    > file and clicking 'Run as administrator', then the security box comes up -
    > this is fine, that is EXACTLY what I want to happen. The user already has
    > adminitrator privilages and I understand that I'll never get around the
    > security box coming up - I don't mind this, but I can't seem to find a way
    > of replicating this.
    > <!--colorc--><!--/colorc-->

    I believe (haven't had to do this for a long time, and don't have a
    Vista machine handy to test it) that in order to use Runas.exe in the
    batch file, you'd have to specify the user account, and then it will
    prompt for a password as necessary.

    RUNAS USAGE:

    RUNAS [ [ oprofile | /profile] [/env] [/savecred | etonly] ]
    /user:<UserName> program

    RUNAS [ [ oprofile | /profile] [/env] [/savecred] ]
    /smartcard [/user:<UserName>] program

    RUNAS /trustlevel:<TrustLevel> program

    oprofile specifies that the user's profile should not be
    loaded.
    This causes the application to load more quickly, but
    can cause some applications to malfunction.
    /profile specifies that the user's profile should be loaded.
    This is the default.
    /env to use current environment instead of user's.
    etonly use if the credentials specified are for remote
    access only.
    /savecred to use credentials previously saved by the user.
    This option is not available on Windows 7 Home or
    Windows 7
    Starter Editions
    and will be ignored.
    /smartcard use if the credentials are to be supplied from a
    smartcard.
    /user <UserName> should be in form USER@DOMAIN or
    DOMAIN\USER
    /showtrustlevels displays the trust levels that can be used as
    arguments
    to /trustlevel.
    /trustlevel <Level> should be one of levels enumerated
    in /showtrustlevels.
    program command line for EXE. See below for examples

    Examples:<!--coloro:blue--><span style="color:blue <!--/coloro-->
    > runas oprofile /user:mymachineadministrator cmd
    > runas /profile /env /user:mydomainadmin "mmc %windir%system32dsa.msc"
    > runas /env /user:user@domain.microsoft.com "notepad "my file.txt""<!--colorc--><!--/colorc-->

    NOTE: Enter user's password only when prompted.
    NOTE: /profile is not compatible with etonly.
    NOTE: /savecred is not compatible with /smartcard.


    --

    Bruce Chambers

    Help us help you:




    They that can give up essential liberty to obtain a little temporary
    safety deserve neither liberty nor safety. ~Benjamin Franklin

    Many people would rather die than think; in fact, most do. ~Bertrand Russell

    The philosopher has never killed any priests, whereas the priest has
    killed a great many philosophers.
    ~ Denis Diderot
     
  4. Dave-UK

    Dave-UK Guest

    "Timbo" <me@home.com> wrote in message news:OUTluRfPKHA.1232@TK2MSFTNGP05.phx.gbl...<!--coloro:blue--><span style="color:blue <!--/coloro-->
    > Please, please can some one help me...
    >
    > I am trying to run a batch file in vista as an administrator. I know I can
    > use the RUNAS command, but this prompts me for a password. (and what
    > password is a mystery to me as it's a non domain machine and there isn't a
    > user called administrator, but that's besides the point). What I am
    > looking to do is to replicate the behaviour of Right Clicking on the batch
    > file and clicking 'Run as administrator', then the security box comes up -
    > this is fine, that is EXACTLY what I want to happen. The user already has
    > adminitrator privilages and I understand that I'll never get around the
    > security box coming up - I don't mind this, but I can't seem to find a way
    > of replicating this.
    >
    > Any ideas will be greatfully received.
    >
    > Thanks
    >
    > Tim
    >
    ><!--colorc--><!--/colorc-->

    Try creating a shortcut to the batch file.
    Right-click the shortcut and select Properties.
    On the Shortcut tab select Advanced.
    Tick 'Run as Administrator' , Ok and Apply.
    Run the shortcut.
     
  5. Bob

    Bob Guest

Share This Page