is there a single line command wherein I can run a command as an administrator from any non-admin account to create a new user using the administrator username and password?
I think you're looking for sudo.
Related
How do I run a program from command prompt as a different user and password
This command not good :
runas /user:test cmd
Enter the password for test:
I need a single line order, whit password included
Thank you
I have logged in with one user in my system. Like, userA. Now, I have opened command prompt window with administrator privileges. In same Administrator command prompt window need to run my EXE file for userA without the password.
I have tried "RunAs" command but it will ask for Password.
Is there any other alternative, where I can solve my problem.
I have logged in with one user in my system. Like, userA.
Ok...
In same Administrator command prompt window need to run my EXE file for userA without the password.
So you are already logged in as userA why would you need to enter the passsword again?
If you need to run something as as a different user you can create a batch file and set up a scheduled task to run it with their credentials, but don't actually give it a schedule. When you are then logged in as a differnt user you can call the scheduled task and it will run as the user it is associated with.
I was trying to change my windows password via command:
net user Adminstrator newpassword
However, I accidentally did this
net user Administrator "newpassword"
There is no special character in the password
Now I am not able to logon my Administrator account via either newpassword or "newpassword"
Please help.
Thank you.
Best regards,
Apparently it is an issue for Windows password change command, that you cannot put double quotes in the password, and if you did, the command will be executed successfully but nobody knows what the password is.
I resolved this issue via resetting admin password to default following the instruction at:
http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ResettingAdminPassword_EC2Config.html
I was lucky I am having this issue with AWS EC2 instance, otherwise I won't be able to resolve like that.
It happens when using escape sequence in command prompt
Run the following command in command prompt with administrator privilege
echo EnteredPassword >> C:\ActualPassword.txt
EnteredPassword is the password that you entered in the command prompt
And your actual password will be available in C:\ActualPassword.txt
Assume I am user A(not root user) and I want to run a c-shell script which will execute command in User B(password for B is known to me) and will use the result of that command here.
How can I run a command in User-B.
sudo -u username command1
Above command may prompt for password but I want this to be done in script only.
Thanks for all your suggestions.
you could use a ssh key to allow your user A to log in as user B using user A's private key (and with user A's public key in ~B/.ssh/authorised_keys)
then you simply execute the script as B with:
ssh B#localhost "/path/to/script and maybe some arguments here"
you have following options,
run your command with root so that su - username wont prompt for password
create passordless login for user like passwordless ssh,remove password for user etc. and then run your command
for getting output here to work,
write it in a file and access it in code
store it in a variable and access it in code
Is there any single line command for Run As Different User in Windows 7.
I am using following command but then it ask for password
runas /user:USER-NAME "C:\full\path\of\Program.exe"
Is there any way to supply password also in above line ? Actually i am launching application from other application so I don't want any user interaction But in above command it ask user for PASSWORD
PsExec in the MS SysInternals suite:
psexec -user Administrator -p Passwd "xcopy a.xml \\server_over_there\c$\A.xml"
In case the local user is NOT what you need and a specific DOMAIN user is, use:
/user Username in form USER#DOMAIN or DOMAIN\USER
(USER#DOMAIN is not compatible with /netonly)