Help: command line with no UAC interferance?

G

Guest

Have seen a lot of traffic in this newgropus about UAC and command line....is
not helping for things I need. I want to run things from the command line
like chkdsk and defrag...without UAC prompts or prompts for passwords.

1) Have tried "runas" in various forms (runas /trustlevel:Unrestricted "cmd
/T:4F /k") but when I try defrag c: -f from the red command window I still
get the UAC prompt.

2) Trying to run things "automagically" and running from the command prompt
doesn't help if I have to input a password....

Please don't respond with why UAC is my friend...I agree, and am trying to
find a way to do this without shutting UAC off.

I want to run these simple commands from the command line without GUI
warning messages/prompts and without user interaction (no password requests).
PS: I'm also looking at doing this from the command line using Task
Scheduler, but that seems farily complicated...
 
A

AJR

Turn off UAC! - also you can use the "search" box in place of "run as" -
just type command desired (though still get UAC stuff).
 
M

Mark D. VandenBeg

Click on the Start Orb, type "cmd", then right click on the result and
select "Run As Administrator"
 
J

Jimmy Brush

Hello,

- Right-click in an explorer window
- click New
- Click Shortcut
- Type: cmd
- Click Next
- Click Finish
- Right-click the shortcut
- Click Properties
- Click advanced
- Click Run As Administrator checkbox
- Click OK
- Click OK

- JB

Vista Support FAQ
http://www.jimmah.com/vista/
 
J

Jimmy Brush

Are you trying to use the commands in a script? Maybe if you told us exactly
what you are hoping to accomplish we can help you.

In general, here are the rules:

- Any program that needs admin permission that interacts with the user will
show a UAC prompt, no matter how it starts. Period.

- A program that runs as a service or from task scheduler can run with
elevated privileges without throwing a UAC prompt, but it will not be able
to interact with the user (it will not be visible on the screen).

- JB

Vista Support FAQ
http://www.jimmah.com/vista/
 
G

Guest

Thanks for the ping back (and for reading the entire message, as right
clicking and "running as administrator" or turning of UAC are not suggestions
that solve my problem....I'm starting to wonder if the issues I'm having are
a problem in this build (5384) or more likely something self inflicted in my
UAC settings....early on I tried turning them off, but you get Security
Center warnings so I let Vista reset them.

Essentially, I want to run known, trusted things like defrag and chkdsk from
the command line without any UAC interferance or requests for passwords
pretty much like you can on XP (i.e., along the lines of I am the
administrator of my own machine, know what I'm doing and want to run these
things)...I can put these commands into a script or not, or possibly run them
out of Task Scheduler....nothing is working (I can run things in Task
Scheduler if I go through it's GUI, but have not had success trying to access
it and make similar changes through the command line though the Vista
documenation suggests I should be able to do so).

So am trying to keep it as simple as possible and just run from a command
line, but am stuck in the sense that I either need to shut UAC off (not what
I want) or I get prompted with it's GUI (also, not what I want).

When I try what is suggested below, I can create the shortcut just fine, but
when I right click, select properties, and Compatibility, all the boxes are
grayed out. My account is an "administrator" account with a strong password
(8 characters, letters/numbes/upper lower case with things like #)....have
also tried this is the real "Administrator" account through safe mode, but as
it says in Vista's help and on the web this doesn't work either.

I am getting all indications that other people are able to get things to run
that are being roadblocked on my machine. I created an "image" right after
I put Vista on the machine (an upgrade from XP)...so maybe I'll go back to
that? Is there a Local Security Policy setting that I can tweek? Thanks for
giving this a think..
 
J

Jimmy Brush

Essentially, I want to run known, trusted things like defrag and chkdsk
from
the command line without any UAC interferance or requests for passwords
pretty much like you can on XP (i.e., along the lines of I am the
administrator of my own machine, know what I'm doing and want to run these
things)..

Unfortunately, what you describe is not currently possible EXACTLY the way
you describe (having trusted programs that always run with admin
privileges).

The reason is because Windows does not know the difference between you
starting a program and another program starting a program. If you "bless" a
program by giving it permission to always run as admin, other programs can
also start that program, and use it to hijack your system. Imagine a program
taking control of a command prompt if you have set command prompt to always
run as administrator.

Now, you have mentioned that "run as administrator" on command prompt
doesn't work for you. When you do this, you should get a single "UAC" prompt
before command prompt opens. After that, you should not see another UAC
prompt regardless of what program you run from within the command prompt.

If this is not the way it works on your machine, then that's a bug... the
way I described is the way it should be working.

Just out of curiousity .. you are trying to run "cmd.exe" as admin, and not
"command.com", correct?
I can put these commands into a script or not, or possibly run them
out of Task Scheduler....nothing is working (I can run things in Task
Scheduler if I go through it's GUI, but have not had success trying to
access
it and make similar changes through the command line though the Vista
documenation suggests I should be able to do so).

I am not familiar with the task scheduler command line interface. However,
you would need to be running command prompt as admin in order to use it. If
your command prompt is having trouble being ran as admin, I could see why
you would be having difficulties.
So am trying to keep it as simple as possible and just run from a command
line, but am stuck in the sense that I either need to shut UAC off (not
what
I want) or I get prompted with it's GUI (also, not what I want).

Like I said earlier, the best way of doing this is living with the ONE UAC
dialog you get when running command prompt as admin. You are correct in that
those are your options, and the only secure "middle way" you have is the run
as administrator tool.

BTW, I also noticed you said you have to enter your password in order to run
a program with admin privileges... did you set this up yourself? If not, did
you change your user type to STANDARD user? Because this should only happen
if you are a STANDARD user by default.
When I try what is suggested below, I can create the shortcut just fine,
but
when I right click, select properties, and Compatibility, all the boxes
are
grayed out. My account is an "administrator" account with a strong
password
(8 characters, letters/numbes/upper lower case with things like #)....have
also tried this is the real "Administrator" account through safe mode, but
as
it says in Vista's help and on the web this doesn't work either.

You are going to the wrong place. You should be under the SHORTCUT tab.

- Right-click the shortcut
- Click Properties
- Click the SHORTCUT tab if it is not already selected
- Click "Advanced..." button
- Click Run As Administrator checkbox
- Click OK
- Click OK
I am getting all indications that other people are able to get things to
run
that are being roadblocked on my machine. I created an "image" right
after
I put Vista on the machine (an upgrade from XP)...so maybe I'll go back to
that? Is there a Local Security Policy setting that I can tweek? Thanks
for
giving this a think..

Let me know what exactly happens when you right-click command prompt, click
run as administator, and then run an admin tool. Also, please confirm that
your account is an administrator.

Depending on your configuration, I may have a possible solution for you.

- JB

Vista Support FAQ
http://www.jimmah.com/vista/
 
G

Guest

Sorry...I tried that and had problems, and so was asking about
Compatibility....can you help? Everything seems to work as suggested until I
click on the "advanced" button off of the "Shortcut Tab"....all I get is one
check box "Run with Different Creditials" which doesn't seem to do anything
and a grayed out check box for "run in separate memory space". I don't get a
choice for "Run As Administrator".

- My account says "Administrator" in User Accounts
- I am adding "cmd", not "command"
- Vista just blew up and I resinstalled it, so I haven't changed any of the
UAC settings

Am I not really an administrator even though it says I am? Again, I think
I'm following your suggestion:

- Open up an explorer window (am using "Documents" in my User folder
- Right click and select "New" and then "Shortcut"
- Type "cmd", "Next" and "Finish" (confirms that I am using cmd.exe")
- Right click the newly created shortcut and select properties....the
"Shortcut" tab is the default along with "general, Options, Font, Layout,
Colors, Compatibility and Previous Versions"
- Select the Advanced button
 
J

Jimmy Brush

Ok ... I must be using a newer build than you. I thought that was working
back then...

What build are you running?

Does the right-click, run as administrator work for you now that you
reinstalled?
 
G

Guest

Yes, right clicking on the command prompt and saying "run as administrator"
works (but doesn't help for what I'm trying to do)....my build is 5384.
 
J

Jimmy Brush

OK, well it sounds like everything is working properly on your system them -
you should not be able to run any system configuration tool or tool that
affects the settings/state of the entire computer, regardless of how it
starts, without seeing a UAC prompt.

The only exception to this is tools ran via task scheduler, or a service,
that runs in the context of a system-owned account. In this case, the task
will not be visible to you and you will not be able to interact with it at
all, and it will have to be set to start at a certain time in the case of a
scheduled task.

To start or stop such a task, you will have to go thru a UAC prompt.

Microsoft designed this very, very well so that there is no way to do
something that needs admin permission without going thru UAC, no matter how
you try to sneak around it, unless it is a pre-authorized scheduled task or
service, that starts automatically and is not
startable/stoppable/controlable unless you go thru a UAC prompt.

I will again repeat my original suggestion - live with the one UAC prompt
you get when running command prompt as admin. It's not that big of a deal.

Your only other option is to disable UAC. The best way to do this is not to
disable it COMPLETELY, but instead to tell it to never show a UAC dialog.
This will, in effect, always click Continue whenever an application throws a
UAC dialog. However, if an application does NOT throw a UAC dialog, it will
only be opened as a standard user. So, you will still have to run command
prompt "as administrator", but you will not have to go thru a UAC dialog.

WARNING - This WILL disable the security of your system because any program
that requests admin permissions will automatically be granted permission
without your consent.

Click Start -> Control Panel -> System and Maintenance -> Administrative
Tools
Double-click Local Security Policy
Expand Local Security Policy -> Security Options
Find "User Account Control: Behavior of the elevation prompt for
administrators in Admin Approval Mode"
Double-click it and change it to "No Prompt" or "Elevate without prompting"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top