How to run 'runas` program in Windows as administrator without password - windows

I have a Python code that finally generates a file and it should automatically run that file as admin. I did search and found that I should use runas program, but it requires admin password.
Since I have not set any administrator password, so it should not ask for password in order to work.
The script is route add -p IP to change routing table.
There are multiple PCs in the office and all PCs have one user like saeed, david, etc. and administrator of course which has not been used yet.
The command I use is the following that asks for admin password:
C:\Users\Saeed\Desktop> Runas /profile /user:administrator ips.cmd
Enter the password for administrator:
Attempting to start new-ips.cmd as user "DESKTOP-9PR0R3P\administrator" ...
RUNAS ERROR: Unable to run - new-ips.cmd
1326: The user name or password is incorrect.
Is that possible to run run as passwordless?
I should mention that if with my current PC, I right click on ips.cmd and Run As Administrator, it does not prompt any password and runs the file.

Using this command works for me:
powershell.exe "Start-Process powershell -verb runAs"

Related

PsExec works only with "runas /netonly", not with -u and -p parameters

What I mean:
If I...
run runas /netonly /user:computername\username cmd
enter the password for the local admin account "username"
then type psexec \\computername cmd
I now have a working shell and can run commands as the local admin user on the remote machine.
However, trying to run this without the runas... and instead with the username and password arguments of psexec returns an access denied error.
Example below:
psexec \\computername -u username -p password cmd
Access Denied
Note: Others seem to also have this issue. My refined questions:
Is this intended behavior?
Why even have the -u and -p?
I have also tried disabling the firewall on both my machine and the target machine, and adding the registry key listed here.
When you initiate a connection with PsExec.exe, it tries to use the credentials you are currently authenticated with to copy the PSEXESVC to the \\$machine\ADMIN$\System32 share VIA SMB, which enables the communication with your PsExec.exe and the $machine's service.
If your currently logged in user account does not have access to \\$machine\ADMIN$\System32 and the ability to install/start services, then this won't work.
I'm assuming if you have access with your user account that this would work.
Here is a very interesting article from 2004 on reverse-engineering of the original implementation. I am pretty sure it has changed in that time with Windows 7 & Windows 10.

Entering the password in cmd on Windows Ruby

I'm trying to run runas command in Windows but it asks about password. I use system('runas /user:username cmd') but it needs entering the password manually. Is there any possibility to enter automatically this password in my ruby script? Saving password in any file is forbidden.
--edit: ReggieB suggested to add some more information.
I'm writing a fact for Puppet. We have puppet agents installed on local Administrator accounts and local Administrator can't have access to information about domain users. Because of this I decided to run cmd as domain user that can have access to domain users. The problem is that runas command needs to manually enter the password. It's impossible to do this in facts so I need some method in Ruby that will do this automatically. I need to do
system('runas /user:username cmd')
and some method that enter the password in command prompt instead of me.

Can't force psexec to use the given user account

I used to use runas for running my app under another user account. Now I need to pass the password through as well. I found that psexec is an easy way to do it.
So the batch file contains:
#echo off
psexec my.exe -u hostname\user -p password
The problem is my.exe is still being initiated under the user I'm currently logged onto the system with and not under the one declared in the cmd above.
the program must be the last argument
try this :
psexec -u hostname\user -p password my.exe

Automatically run as administrator programs on Windows

I want to run some program with other domain users. For example;
Program: X
My domain : Y
Other domain user: Z
I tried " runas /u:Y\Z X " but always I have to enter other domain user password. I want to enter password only one time then program should run same user and password without ask password.
Thanks
create a batch file or similar in a start-up folder with the contents:
runas /user:domain\admin C:\Path\To\ProcessExplorer.exe
Before rebooting, run
runas /savecred /user:domain\admin C:\Path\To\ProcessExplorer.exe
It will prompt you for the password only this one time; note that the admin password will be saved to your Windows profile (not usually a good idea); and this does not work for Win7 Home or Starter editions.

Single line command for Run as a different user on Windows 7 that contains a password also

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)

Resources