Launch Notepad.exe using PsExec sysinternal tool - windows

I am trying to launch notepad.exe on remote server A from local server B.
below is the command which works fine and I could see notepad.exe process on Task Manager however when I physically remote login to server I do not see notepad launched (GUI).
C:\Windows\System32>D:\SysInternals\psexec.exe \\serverB
-u Domain\user1 -p passXX -i -d notepad.exe
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
notepad.exe started on serverB with process ID 3328.
How would I see notepad GUI when logged in ?

is serverB a terminal server ? if so you have to specify the user's session number, otherwise notepad will be opened in the console (session 0).
you can use for example query session to get the active session on you server :
query session /server:serverB user1
then pass the session number to -i parameter :
psexec \\serverB -u domain\user1 -i 2 notepad.exe
where 2 is the session of user1

Related

Using psexec on a bat file that contains psservice

I have a bat file that tries to stop a service on a remote machine, the file contains the following
psservice \\remoteServerName -u domainName\userName -p password stop serviceName
where userName is a name of a user with Admin privileges on the remote machine.
If I run the last line using cmd then the requested service does stop.
I, however, run the bat file using psexec, since it contains more operation than just stopping the service. This is where my problem occurs:
If I run
psexec -u domainName\userName -p passsword batFilePath
the cmd window seems to get stuck.
But if I run
psexec batFilePath
then the psservice executes correctly.
My problem is that I need the user "domainName\userName" to be able to run the other commands in the bat file.
What can I do ? Why does the cmd got stuck when I gave psexec the parameters of the userName and password ?

Psexec does not open the application

When I run psexec from my machine to open notepad in the remote machine, I see notepad is running as a process, but nothing is there in the Application list and notepad window has not opened in the remote window.
c:\Users\Ask\Downloads\PSTools>psexec -h -u administrator -p force \\135.20.230.167 notepad.e
xe
What might be the reason?
Thank you for your help.

can't start notepad on remote machine using psexec

I need execute some script in remote computer, I try to start notepad. I use psexec, this command
psexec -e -i 1 \\localhost -u domain\user -p password cmd /c notepad.exe
successfully opens notepad on my local machine, but doesn't do it on remote.
I can't see any error, output is the same as I see after executing on local machine:
PsExec v2.0 - Execute processes remotely
Copyright (C) 2001-2013 Mark Russinovich
Sysinternals - www.sysinternals.com
What could be a reason I can't execute notepad successfully on remote machine?
To start notepad on remote machine using psexec:
psexec \\RemoteserverHOSTNAMEorIPADDRESS -u domain\user -p password -d -i cmd /c notepad.exe
For more information.....PsExec

PSexec on remote machine hangs running from Teamcity

I'm running TeamCity version 7.1.4 with a step that uses PSEXEC in order to run batch file on a remote machine. The batch file should extract files and deploy them.
Running the PSEXEC from command prompt completes the task.
Running from team city i always get the following hang:
PsExec v1.98 - Execute processes remotely [12:19:34]Copyright (C)
2001-2010 Mark Russinovich [12:19:34]Sysinternals -
www.sysinternals.com
It hangs because PsExec shows a window to accept the End User Agreement.
I solved adding the
-accepteula
switch to the command.
This flag suppresses the display of the license dialog.
Read Using PsExec for full command line parameters.

PsExec hangs when executing batch file in bamboo continous integration server

I have a batch file on my bamboo server, that starts another batch file on an remote computer trough PsExec. If I double click the batch file on the bamboo sever everything is working fine, the batch file on the remote computer starts and PsExec exites with error code 0.
But if I start bamboo then PsExec hangs itself and the batch file on the remote computer don't start.
C:\PsTools>PsExec.exe \\<remote server> -u <user> -p <password> -s -i "C:\batchfile.bat"
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
This is my output and where PsExec hangs.
I don't understand why it hangs only when bamboo starts the batch.
Hope someone can help me
[ Program output lost when passed through PsExec ]
there's a bug in psexec and it does redirects correctly when is called by everything different by cmd. You have few more options to start a process on remote machine:
1. http://feldkir.ch/xcmd.htm - it cannot be run on localhost
2. WMIC - also cannot be used on localhost , when host and and user/pass are given
2. SCHTASKS
This is an old question but maybe somebody has the same problem.
The first time you run psexec an eula dialog is shown. In order to avoid bamboo hanging with this dialog you may try the argument \accepteula. For instance:
PsExec.exe \\<remote server> -u <user> -p <password> -s -i "C:\batchfile.bat" -accepteula

Resources