Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Vista Newsgroups > Vista security

Vista - How do I bring up the Administrator Command Prompt?

Reply
 
Old 10-31-2006   #1 (permalink)
Brandon Baker, MCSE


 
 

How do I bring up the Administrator Command Prompt?

I tried to adapt my XP defrag script to Vista x64 RC1, but I ran into a snag.

When I execute the defrag command I get a nice message (below) that I need
to elevate my privs to run the defrag.exe cmd.
______________________________________________________________
C:\Windows\System32>defrag c:

This program needs to run with administrative permissions. Use an
administrator
command prompt and then run the program again.
______________________________________________________________

So, I searched help and no reference to the Admin Cmd Prompt.

My account has admin level privs, but this is apparently not enough, so how
does one elevate the command line privileges to Administrator? Are we talking
a runas cmd.exe?

I've only had Vista on the system for 2 days, so please don't crucify me for
posting a n00b question.


--
Good Sites to know:
http://www.sysinternals.com
http://www.eventid.net
http://www.microsoft.com/technet
http://www.isaserver.org
http://www.nu2.nu/pebuilder


My System SpecsSystem Spec
Old 10-31-2006   #2 (permalink)
Jimmy Brush


 
 

Re: How do I bring up the Administrator Command Prompt?

Hello,

In Windows Vista, even though you have administrator privileges, the
programs you run only receive "standard user" permissions, unless they
automatically ask you for permission ("Windows needs your permission to
continue") or you explicitly give them such permision (right-click on them
and click Run As Administrator).

This is technically different that the runas command when logged into an
administrative account - when you right-click and click Run As
Administrator, the program runs inside of your user profile with your admin
powers. However, using runas, the program will run under a different user
profile.

I do not believe there is a command-prompt equivalent to right-click and
click run as administrator.

A shortcut you can use:

- click start
- type: cmd
- press the right-ctrl, right-shift, and enter at the same time

This will do the same thing as right-click cmd.exe and clicking run as
administrator. It will work for any exe that you type into the start search
bar.


--
- JB

Windows Vista Support Faq
http://www.jimmah.com/vista/

My System SpecsSystem Spec
Old 10-31-2006   #3 (permalink)
Frank Saunders, MS-MVP OE/WM


 
 

Re: How do I bring up the Administrator Command Prompt?

"Brandon Baker, MCSE" <brandonsbaker@gmail.com> wrote in message
news:FEDEA549-237C-469B-8553-9712C9A5F3C2@microsoft.com...
>I tried to adapt my XP defrag script to Vista x64 RC1, but I ran into a
>snag.
>
> When I execute the defrag command I get a nice message (below) that I need
> to elevate my privs to run the defrag.exe cmd.
> ______________________________________________________________
> C:\Windows\System32>defrag c:
>
> This program needs to run with administrative permissions. Use an
> administrator
> command prompt and then run the program again.
> ______________________________________________________________
>
> So, I searched help and no reference to the Admin Cmd Prompt.
>
> My account has admin level privs, but this is apparently not enough, so
> how
> does one elevate the command line privileges to Administrator? Are we
> talking
> a runas cmd.exe?
>
> I've only had Vista on the system for 2 days, so please don't crucify me
> for
> posting a n00b question.
>



Start | All Programs | Accessories
Right click the Command Prompt and choose Run as Administrator.

--
Frank Saunders, MS-MVP OE/WM
http://www.fjsmjs.com
Answer in newsgroup. Don't send mail.


My System SpecsSystem Spec
Old 10-31-2006   #4 (permalink)
Brandon Baker, MCSE


 
 

Re: How do I bring up the Administrator Command Prompt?

All good information and very appreciated, but I'm still unclear on one
point. If I schedule this cmd file using Task Scheduler - will the task
scheduler automatically run the program with administrator privs, or will I
just see a runas prompt when the task executes? Can I schedule this task
using my own Account, or do I now have to schedule it using the local admin
acct?

I will try it when I'm home from work tonight, and post my results.

Thanks,

--
Good Sites to know:
http://www.sysinternals.com
http://www.eventid.net
http://www.microsoft.com/technet
http://www.isaserver.org
http://www.nu2.nu/pebuilder



"Frank Saunders, MS-MVP OE/WM" wrote:

> "Brandon Baker, MCSE" <brandonsbaker@gmail.com> wrote in message
> news:FEDEA549-237C-469B-8553-9712C9A5F3C2@microsoft.com...
> >I tried to adapt my XP defrag script to Vista x64 RC1, but I ran into a
> >snag.
> >
> > When I execute the defrag command I get a nice message (below) that I need
> > to elevate my privs to run the defrag.exe cmd.
> > ______________________________________________________________
> > C:\Windows\System32>defrag c:
> >
> > This program needs to run with administrative permissions. Use an
> > administrator
> > command prompt and then run the program again.
> > ______________________________________________________________
> >
> > So, I searched help and no reference to the Admin Cmd Prompt.
> >
> > My account has admin level privs, but this is apparently not enough, so
> > how
> > does one elevate the command line privileges to Administrator? Are we
> > talking
> > a runas cmd.exe?
> >
> > I've only had Vista on the system for 2 days, so please don't crucify me
> > for
> > posting a n00b question.
> >

>
>
> Start | All Programs | Accessories
> Right click the Command Prompt and choose Run as Administrator.
>
> --
> Frank Saunders, MS-MVP OE/WM
> http://www.fjsmjs.com
> Answer in newsgroup. Don't send mail.
>
>

My System SpecsSystem Spec
Old 10-31-2006   #5 (permalink)
Jimmy Brush


 
 

Re: How do I bring up the Administrator Command Prompt?

The task will be run just as if you had ran it inside your user account -
i.e. it will run with restricted privileges. You will need to set the task
to run in the context of one of the system accounts in order for it to work
properly. When this is the case, you will not be able to "see" the command
executing - it will not be associated with the visible desktop.

I am unsure of the behavior if you set the task to run in the context of the
built-in administrator or any other administrator for that matter.


--
- JB

Windows Vista Support Faq
http://www.jimmah.com/vista/

My System SpecsSystem Spec
Old 11-20-2006   #6 (permalink)
Gerry Hickman


 
 

Re: How do I bring up the Administrator Command Prompt?

Frank Saunders, MS-MVP OE/WM wrote:

> Start | All Programs | Accessories
> Right click the Command Prompt and choose Run as Administrator.


If he does that, which user profile will the task run within?

--
Gerry Hickman (London UK)
My System SpecsSystem Spec
Old 11-20-2006   #7 (permalink)
Jimmy Brush


 
 

Re: How do I bring up the Administrator Command Prompt?

If you are logged in as a user that is a member of the administrators group,
the command prompt will be running from the currently logged in user's
profile.

However, if you are logged in as a "normal user", the command prompt will
run from the user profile of whomever authenticated into the UAC dialog box.


--
- JB

Windows Vista Support Faq
http://www.jimmah.com/vista/

My System SpecsSystem Spec
Old 11-20-2006   #8 (permalink)
Ben Miller


 
 

Re: How do I bring up the Administrator Command Prompt?

If you are looking to add this to a script this might help:

runas /user:administrator cmd

You can replace the cmd with the batch file or vbs script or whatever app
you intend to run with administrative credentials.

Hope this helps!

-Ben

______________
Ben Miller
CISSP
GSEC
Security+


"Brandon Baker, MCSE" <brandonsbaker@gmail.com> wrote in message
news:FEDEA549-237C-469B-8553-9712C9A5F3C2@microsoft.com...
>I tried to adapt my XP defrag script to Vista x64 RC1, but I ran into a
>snag.
>
> When I execute the defrag command I get a nice message (below) that I need
> to elevate my privs to run the defrag.exe cmd.
> ______________________________________________________________
> C:\Windows\System32>defrag c:
>
> This program needs to run with administrative permissions. Use an
> administrator
> command prompt and then run the program again.
> ______________________________________________________________
>
> So, I searched help and no reference to the Admin Cmd Prompt.
>
> My account has admin level privs, but this is apparently not enough, so
> how
> does one elevate the command line privileges to Administrator? Are we
> talking
> a runas cmd.exe?
>
> I've only had Vista on the system for 2 days, so please don't crucify me
> for
> posting a n00b question.
>
>
> --
> Good Sites to know:
> http://www.sysinternals.com
> http://www.eventid.net
> http://www.microsoft.com/technet
> http://www.isaserver.org
> http://www.nu2.nu/pebuilder
>


My System SpecsSystem Spec
Old 11-21-2006   #9 (permalink)
Jimmy Brush


 
 

Re: How do I bring up the Administrator Command Prompt?

Unfortunately, this would not work out-of-the-box as the administrator
account is disabled by default.

Also, this does not exactly reproduce the behavior of the UAC "elevation"
sequence - this would always run the program from the user profile of the
"administrator" account, whereas UAC elevation runs the program from the
currently logged-in administrator account (assuming the logged-in user is an
administrator).

However, if the administrator account has been manually enabled and one
doesn't mind the application running from the profile of the administrator
account, this is a good alternative


--
- JB

Windows Vista Support Faq
http://www.jimmah.com/vista/

My System SpecsSystem Spec
Old 11-21-2006   #10 (permalink)
Gerry Hickman


 
 

Re: How do I bring up the Administrator Command Prompt?

Hi Jimmy,

You make a good explanation below and you are right to point out the
issues, but some of us need to run unattended scripts overnight and we
don't allow our users to have Admin rights. In this context, the only
sensible option (I can see) is to enable the real Administrator (or a
clone) and disable UAC.

I can only understand UAC in the context of the home user. I don't see
how it's supposed to help with overnight unattended installations and
change and configuration management?

In the context of the home user it seems a terrible idea to me; it's
effectively letting them still run as Administrator but they have to
keep clicking "OK"? They'll just get used to saying "OK" then when they
get a job in a corporation, they'll still keep saying "OK"? What does it
achieve?

Jimmy Brush wrote:
> Unfortunately, this would not work out-of-the-box as the administrator
> account is disabled by default.
>
> Also, this does not exactly reproduce the behavior of the UAC
> "elevation" sequence - this would always run the program from the user
> profile of the "administrator" account, whereas UAC elevation runs the
> program from the currently logged-in administrator account (assuming the
> logged-in user is an administrator).
>
> However, if the administrator account has been manually enabled and one
> doesn't mind the application running from the profile of the
> administrator account, this is a good alternative
>
>



--
Gerry Hickman (London UK)
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
WHAT TO DO to bring prompt back General Discussion
Bring back icons in the command bar as an option. Live Mail
Solved Make a command prompt run a command as soon as it opens? General Discussion
Please bring command line editing into the 21st century PowerShell
Administrator Command Prompt Vista security


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46