Windows 7: Script to automatically log into network account using PsExec

1

As happens often where I work (At a help desk for a school campus), a new policy with very tedious and/or wasteful requirements comes into effect and I am usually the only one to try to create a better or more efficient solution for the problem.

In this case periodic manual testing of rooms with 20-30 network computers is required. This involves manually logging into every computer in a room and launching various programs and checking things. I have been building a python script with psexec which seems to work pretty well for launching what is needed for testing after all of the computers are logged in, so the main tedious part is the logging in itself.

I am looking for any command prompt .exe, .bat, .vbs, whatever thing I can run to simulate logging into windows with a hardcoded username and password. If you don't know what PsExec is, it just lets me run anything I want as administrator on the remote computer, I just need to know what I need to run!If nothing like this exists I could look into running a compiled autohotkey or something similar, but I have not had luck with that yet and am looking for a better solution.

Thank you for reading and any assistance you can provide.

Because the first answer did not seem to address what I had in mind, I will add this information to my question

I know how to use PsExec pretty well already, what I am looking for is a way to run a process/command which would "log in" (literally) with credentials (interactively / graphically) to the computers. For example, I walk up to the computer, type in a username and password, and press enter. Then the screen says 'welcome/preparing your desktop'. Then the network account desktop appears. I want to initiate/simulate THIS action with psexec.

Edited again because I am bad at wording things

This is a general question attempting to accomplish one specific task that may help other people who need to do this. I have already developed and have a good working script, which, through python, launches a bunch of PxExec processes on one computer and distributes them to all of the computers I need to test. No python is executed on all of the other computers. I do not need help with this part. The only step I have not been able to do, remotely, from one computer, is log into the computers, so that you can see processes that are launched. This part needs to be done by hand, and I wish to remove that problem.

The ideal situation is that:

Psexec is launched on computer A and computer B literally logs into the desktop, as if a user had walked up, typed up their username and password, and pressed enter.

Thanks

Rboreal_Frippery

Posted 2014-12-03T02:38:28.010

Reputation: 123

It is still not very clear what you are asking :/ You want a script that will log into 20 or different computers one by one and then run a python script? Where is the python script located? On each computer? – DavidPostill – 2014-12-03T16:00:28.007

Can't you just create a "help desk" account on each computer that can then run a script that does your "manual" testing? – DavidPostill – 2014-12-03T16:02:27.100

Answers

0

Reference PsExec

Syntax

psexec \\computer[,computer[,..] [options] command [arguments]

psexec @run_file [options] command [arguments]

Options:

computer The computer on which psexec will run command. Default = local system. To run against all computers in the current domain enter "\\*"

@run_file Run command on every computer listed in the text file specified.

command Name of the program to execute

arguments Arguments to pass (file paths must be absolute paths on the target system)

...

-p psswd Specify a password for user (optional). Passed as clear text. If omitted, you will be prompted to enter a hidden password.

...

-u user Specify a user name for login to remote computer(optional).

...

When you specify a username the remote process will execute in that account, and will have access to that account's network resources.

If you omit username the remote process will run in the same account from which you execute PsExec, but because the remote process is impersonating it will not have access to network resources on the remote system.

If you do specify an alternative username/password, then PsExec will send the password in clear text. This may be a security risk if unauthorized network sniffers could intercept traffic between the local and remote system.

Example:

psexec \\machine_name -u machine_name\user_name -p user_password somecommands

Interesting reading:

PsExec Execute processes on a remote system and redirect output to the local system by Mark Russinovich (the author of PsExec)

DavidPostill

Posted 2014-12-03T02:38:28.010

Reputation: 118 938

Perhaps I was not clear enough, I will update my question. I know how to use PsExec pretty well, what I am looking for is a way to run a process/command which would "log in" (literally) with credentials (interactively / graphically) to the computers. For example, I walk up to the computer, type in a username and password, and press enter. Then the screen says 'welcome/preparing your desktop'. Then the network account desktop appears. I want to initiate THIS action with psexec. – Rboreal_Frippery – 2014-12-03T15:53:20.160

@user2205380 Unfortunately what you're looking to do is not possible with PSEXEC. While PSEXEC can log in interactively, it can only display the GUI for it if an account has already logged into the computer interactively. – Lizz – 2014-12-03T19:14:36.967