W7 user right from the command line?

T

ToddAndMargo

Hi All,

I just installed W7 beta in a virtual machine.
I want to run "slmgr -rearm" from the command line.
But, get tagged with "Access Denied: the requested
action required elevated privileges".

Under Linux, this is solved with the "su"
(switch user) command. For instance:
su todd -c "whoami"
will prompt for Todd's password and run the
"whoami" (todd, duh) command.

Does W7 have anything similar? If not, how
do I run "slmgr -rearm" as administrator?

Many thanks,
-T
 
G

Gene E. Bloch

Hi All,

I just installed W7 beta in a virtual machine.
I want to run "slmgr -rearm" from the command line.
But, get tagged with "Access Denied: the requested
action required elevated privileges".

Under Linux, this is solved with the "su"
(switch user) command. For instance:
su todd -c "whoami"
will prompt for Todd's password and run the
"whoami" (todd, duh) command.

Does W7 have anything similar? If not, how
do I run "slmgr -rearm" as administrator?

Many thanks,
-T

Try running the command window in elevated mode. I think if you right-click
on the shortcut for cmd and choose "Run as administrator" you'll be ok.
There's another way, but at the moment I can't think of it, sorry.
 
T

ToddAndMargo

Gene said:
Try running the command window in elevated mode. I think if you right-click
on the shortcut for cmd and choose "Run as administrator" you'll be ok.
There's another way, but at the moment I can't think of it, sorry.

I could not figure out how to get the parameter (-rearm) added to the
right click method. Any way to elevate and add a parameter?
 
G

Gene E. Bloch

I could not figure out how to get the parameter (-rearm) added to the
right click method. Any way to elevate and add a parameter?

Type "slmgr -rearm" in the elevated command window?
 
T

ToddAndMargo

Gene said:
Type "slmgr -rearm" in the elevated command window?

Figured it out. The commands are the same in Vista as W7. :p

1) I had to enable my administrator's account and give it
a password.

2) open a command prompt (cmd)

3) open an elevated command prompt from the
command prompt:

runas /user:VB-W7beta\administrator cmd

4) then, just run the command from the new prompt

slmgr -rearm

I probably could have opened "cmd" with elevated
privileges to start with (but where would the fun be!).

Curious, the following told me slmgr was not
a proper windows command:

C:\Users\Todd>runas /user:VB-W7beta\administrator
"c:\windows\system32\slmgr.vbs -rearm"

Enter the password for VB-W7beta\administrator:

Attempting to start c:\windows\system32\slmgr.vbs -rearm
as user "VB-W7beta\administrator" ...

RUNAS ERROR: Unable to run - c:\windows\system32\
slmgr.vbs -rearm 193: c:\windows\system32\slmgr.vbs
-rearm is not a valid Win32 application.

Hope this helps someone else,

-T
 

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