How do I bring up the Administrator Command Prompt?

Posted: 10-31-2006, 12:25 PM
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

Reply With Quote

Responses to "How do I bring up the Administrator Command Prompt?"

Jimmy Brush
Guest
Posts: n/a
 
Re: How do I bring up the Administrator Command Prompt?
Posted: 10-31-2006, 01:06 PM
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/

Reply With Quote
Frank Saunders, MS-MVP OE/WM
Guest
Posts: n/a
 
Re: How do I bring up the Administrator Command Prompt?
Posted: 10-31-2006, 03:50 PM
"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.


Reply With Quote
Brandon Baker, MCSE
Guest
Posts: n/a
 
Re: How do I bring up the Administrator Command Prompt?
Posted: 10-31-2006, 05:21 PM
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.
>
>
Reply With Quote
Jimmy Brush
Guest
Posts: n/a
 
Re: How do I bring up the Administrator Command Prompt?
Posted: 10-31-2006, 05:53 PM
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/

Reply With Quote
Gerry Hickman
Guest
Posts: n/a
 
Re: How do I bring up the Administrator Command Prompt?
Posted: 11-20-2006, 11:19 AM
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)
Reply With Quote
Jimmy Brush
Guest
Posts: n/a
 
Re: How do I bring up the Administrator Command Prompt?
Posted: 11-21-2006, 01:07 AM
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/

Reply With Quote
Ben Miller
Guest
Posts: n/a
 
Re: How do I bring up the Administrator Command Prompt?
Posted: 11-21-2006, 02:06 AM
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
>
Reply With Quote
Jimmy Brush
Guest
Posts: n/a
 
Re: How do I bring up the Administrator Command Prompt?
Posted: 11-21-2006, 01:52 PM
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/

Reply With Quote
Gerry Hickman
Guest
Posts: n/a
 
Re: How do I bring up the Administrator Command Prompt?
Posted: 11-21-2006, 10:48 PM
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)
Reply With Quote
 
LinkBack Thread Tools Display Modes
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
command prompt Russ Windows XP Basics 22 04-29-2004 05:25 AM
navigating in the command prompt Seth Goldstein Windows XP Basics 1 08-12-2003 07:19 PM
command prompt to uninstall XP, how do i get it?! Guy Incognito Windows XP Basics 2 08-06-2003 02:29 AM
Run this at the command prompt Bob Windows XP Work Remotely 0 07-28-2003 08:12 PM
"The command prompt has been disable by the administrator"... Márcio Veiga Windows XP Accessibility 0 07-15-2003 05:08 PM