user2559121
user2559121

Reputation: 11

Open with admin privileges from user privileged command prompt

Is there a way to open any program as you would with the standard right click "run as administrator" from the command prompt?

I know that this command

runas /noprofile /user:Administrator cmd

opens cmd as the administrator, but if the "hidden" admin account is not active:

net user administrator /active:no

it won't work, and if I want to activate it I need to have admin privileges and we're back to square one.

It doesn't matter if it asks for a password as long as it's from cmd. A "sudo" like on linux.

Upvotes: 1

Views: 18439

Answers (2)

user2559160
user2559160

Reputation:

Assuming that your workstation is on a Windows domain, you could create a Domain Level account that has Admin privileges on all your workstations.

For example, create a Domain User called DOMAIN\WkstnAdmin. Add this WkstnAdmin user to the local administrators group on your workstations using a Domain Admin account (eg. DOMAIN\Administrator which should have full admin privileges) using a script or other remote method.

You can then use this WkstnAdmin account to run in an admin context as required, disable and enable the account as required and change the password as often as you wish.

In any event, I believe at the end of the day you will need to keep an Administrative account active on your PC (be it local or domain) in order to effectively manage your workstations.

Upvotes: 0

Panama Jack
Panama Jack

Reputation: 24478

I think you already answered your own question. RUNAS is as equivalent to linux su more so than sudo that you are going to get.

At some point you're going to have to get admin rights to the windows box to begin with (i.e. activate the hidden admin account etc) because sudo in linux doesn't automatically work either. You have to be added to the sodoers list by someone with access to /etc/sudoers file. So there is some setup involved. All points back to being secure of unauthorized actions.

Upvotes: 1

Related Questions