Hello,
I have a rather simple requirement i.e, open an elevated CMD (not the built-in hidden administrator account but the manually created Admin account) from a standard CMD by inputting the password in the command line itself. I'm trying to avoid bringing up the GUI UAC prompt at all costs because it brings my system to a crawl with the a Disk-Usage spike to 100%. It can take up to a minute for things to normalize.
I've tried using the Runas command with all the variations (unnecessary) in syntax without luck. The one time I got it to run in fluke, it still asked for elevation upon trying to run an elevated command.
I have the hidden Administrator account disabled and it rightly throws up an error as expected.
Code:
C:\Users\NAME>runas /user:NAME-P-V\ADMINISTRATOR CMD
Enter the password for NAME-P-V\ADMINISTRATOR:
Attempting to start CMD as user "NAME-P-V\ADMINISTRATOR" ...
RUNAS ERROR: Unable to run - CMD
1327: Account restrictions are preventing this user from signing in. For example: blank passwords aren't allowed, sign-in times are limited, or a policy restriction has been enforced.
It's the manual Admin A/c elevation that I'm after but it fails saying password is incorrect when it's in fact correct.
Code:
C:\Users\NAME>runas /user:NAME-P-V\Admin CMD
Enter the password for NAME-P-V-pc\Admin:
Attempting to start CMD as user "NAME-P-V-pc\Admin" ...
RUNAS ERROR: Unable to run - CMD
1326: The user name or password is incorrect.
I do have to point out that manual Admin A/c which I've named ADMIN shows up as NAME P V in the net user command for some reason.
Code:
C:\Users\NAME>NET USER
User accounts for \\NAME-P-V
-------------------------------------------------------------------------------
Administrator DefaultAccount Guest
GUEST 2 NAME NAME P V
WDAGUtilityAccount
The command completed successfully.
So, tried running it by enclosing the name within quotes but again no luck.
Code:
C:\Users\NAME>runas /user:NAME-P-V\"NAME P V" CMD
RUNAS USAGE:
RUNAS [ [/noprofile | /profile] [/env] [/savecred | /netonly] ]
/user:<UserName> program
Also tried appending the computername above with -pc with the same result. Can someone point me in the right direction. I can't seem to figure out where I'm going wrong.
Thank you
Edit: Enclosed the whole path "NAME-P-V\NAME P V" within quotes and it did open a new CMD window this time but still fails to run an elevated command.
Code:
C:\Windows\system32>POWERCFG REQUESTS
This command requires administrator privileges and must be executed from an elevated command prompt.
Looks like it's the harmless swearing