Need to run sikuli script on remote PC using PsExec - psexec

I have maintained a sikuli script which runs good for a GUI application on my PC, say PC-A. Also I have PsExec installed on it. My GUI application is installed on PC-B.
What I need to do is, run the sikuli script (on PC-A) to execute for GUI app on (PC-B) using PsExec as mediator, which should pass on my commands at every single line and return the results back to PC-A from GUI application.
SikuliX Script(PC-A) ====== PsExec.exe(PC-A) ======= GUI App(PC-B)
Regards,
Bharath

To run interactively in a specific session of a remote PC you'll need to know the session id on the remote system.
You can then use psexec's -i option to run in that session. From psexec -?
-i Run the program so that it interacts with the desktop of the
specified session on the remote system. If no session is
specified the process runs in the console session.

Related

Invoking a program which uses GetForegroundWindow() over PSExec returns Idle

For automation purposes, I need to know the foreground window process running on a remote machine.
I've written small scripts (C#, Python, Powershell) to do this - each of these scripts is using some or the other form of GetForegroundWindow()
These scripts work perfect if I run them on manually the machine.
But when I use PSExec to run these scripts from a remote machine, all of these return process name = Idle
What could have gone wrong?

Installing interactive msi in Remote Machine with Powershell

I have a .msi file in my remote machine which is in a different domain from my local machine. I am able to connect to the remote machine with powershell but how can I install the msi there. The installation process has a lot of inputs to be given along with pressing 'Next' and then again giving a particular input and radio buttons and many more. Thus it is an interactive installation. In my local I am able to do it with [System.Windows.Forms.SendKeys] to imitate the keyboard inputs but as the process will be running in background in the remote machine I don't think SendKeys will work. And 'psexec' is not an option here because in my remote machine I cannot include PSTools with my Powershell. Is there any way to do it with Invoke-Command and -ArgumentList??
If there is a way then how can I choose sequentially whether to input a text in a particular field or click the next button or click any other button within the application window??
I finally got to solve this puzzle with the help of a automation tool called AutoIt. This tool has its own scripting language and can create .exe files to run a particular application and do the corresponding installation steps based on each successive window the application installer pops. After creating the .exe I copied it to my remote machine using Copy-Item or you can use robocopy, then invoked the .exe remotely with the help of psexec. As I had the misconception previously about psexec, it only needs to be integrated with powershell at the local and thus it automatically creates a session of its own and interacts with the remote machine. This is the command to run the .exe on remote machine:-
psexec -i 2 -s -d \\remote_machine_name -u Username -p Password C:\Path_to_exe\installer.exe
You can actually log on to the remote machine and see in the GUI that it is happening. And yes, obviously you need to have the .msi which will be called to be present there in the remote machine so that the .exe can do its job locally in the remote session.

Psexec executed cmd to run further programs which require user input

I have a small problem with my Powershell script.
What do i want:
open CMD via PSEXEC on a remote machine, and work in this "remoteshell" as if i am in front of this machine. There is a commandline tool which i'd like to run, which requires user input after its started (it runs a own "shell")
What the problem is:
i utilize PSEXEC 2.11 with the following command
.\PSEXEC \\$Global:Endpoint -s -accepteula cmd
Cmd gets started as expected.
When i enter the name of the tool (lets call it tool.exe) the inital screen is loaded. But when the shell appears, nothing happens. I can enter commands but there will be no feedback...
C:\windows\System32>tool.exe
Testing Tool V1.0
Command? >
Then nothing can be entered anymore...
I even cannot stop it by pressing CTRL+C. I need to close the application window to force it to close. :(
Any ideas? Are there programs which cannot run in "user interaction" mode?
For reasons, it cannot run as a window visible on the remote endpoint. It needs to run silent.

Is it possible to log all powershell commands run on a machine?

We have some .net applications running on a server that run powershell scripts. Is there a setting where we can log every single powershell command run on that machine, without modifying our existing applications? I already tried start-transcript . That command only captures the commands run in the current session.
I believe Microsoft calls what you're after "Over the Shoulder Transcription". It's described here, and will be available in WMF5.

executing win32ole script on remote windows machine through telnet

I am trying to create a word document on a remote windows machine. What I am trying is to telnet to the remote windows machine and run a perl script that creates word document through Win32::OLE. But it doesn't seem to work. Is this possible? Because my script has {visible} set to 1 but will that telnet session have access to instances of word application? Atleast I tried it didn't work.
Telnet may not be the best tool to accomplish this, I'm not sure what kind of permissions it has. I recommend using PsExec, which allows remote command execution on windows servers. If it works locally, it will work using PsExec.
For example:
PsExec.exe \\remotecomputer -u userName -p Password Perl C:\path\to\file\file.pl
You can use the -s flag to run as system account, and the -i flag to run it interactively on the desktop. Without the -i flag, it will run in the console session.