Why does this command not work on Windows via SSH? - windows

I'd like to send websites to be opened on my Windows PC from my MacBook via some automations involving SSH.
The following command works fine when I'm running it on my PC, but it only shows up in the task manager when I run it via SSH.
"C:\Program Files\Mozilla Firefox\firefox.exe" -private-window reddit.com
Tried to use it with the runas command as well.
Any idea?
Thanks.

The SSH session works like a normal user session, except it's not given access to the UI (meanings, SSH has no start button to click on, no firefox window and so)
While firefox DOES PROVIDE a way to run the browser for headless (no UI) sessions, you're still expecting your SSH user-session to do something as your non-ssh user session. This is why you see the process running, but you don't see the window.
Please have a look at different thread on the SE:
https://unix.stackexchange.com/questions/10121/open-a-window-on-a-remote-x-display-why-cannot-open-display
Which explains how to achieve what you want in a different way

Related

How to open GUI application on Windows via SSH if no active user sessions?

I am working on a project where I need to run a few tests through SSH using an interactive GUI application on multiple Windows VMs. I have seen various other solutions here for launching the GUI application such as with psexec or running schtasks and a .bat file. I have tried all of that. Unfortunately, the only time the GUI opens is when there is an active user session. For example, if I do something like psexec -i 22 path\to\bat\file it will launch the GUI with my active RDP session. This will still work while I am disconnected, as the user session is still active. However, if I log out of the user session entirely and try the same (either with psexec or directly running a bat with schtask), it won't work. It will simply run the GUI application as a background process, as when I login again with RDP, the GUI isn’t present and it only shows as a background process in the task manager.
Is there a way to trigger an RDP or some GUI style user session to become active in a headless manner? If not, then is there a different way to execute my application, where the interactive GUI is available with SSH or other means of headless connection when there is no active user signed in?
The Windows VMs have OpenSSH server running for connections.
This question actually solved the other half of the puzzle for me, namely how to get SSH connections to use the interactive session. Here's how to keep an active interactive session open at all times. Note that depending on your use case you might explicitly need a multi-session windows installation, which is a different VM image in Azure for example.
Have the user you want these commands to run in log on automatically when windows boots. https://learn.microsoft.com/en-us/troubleshoot/windows-server/user-profiles-and-logon/turn-on-automatic-logon
Create a .bat file with the following contents somewhere (for me it's just on C:) tscon 1 /dest:console
In task scheduler, create a task that runs this bat file whenever a remote user disconnects.
Point 2-3 are not necessary if you never RDP into the autologon user. Whenever you RDP to this user, the console session moves from the autologon session to your RDP session, and this script just reattaches the console session back when you disconnect. This way, that user always has the console attached and thus has GUI available.

Start the websocket server automatically on Windows without a visible command prompt window

I want to start a websocket server, like using the "php artisan websocket:serve", but that automatically start with windows, and without a windows of command prompt. I know how to do it on linux with supervisor, but i need to do that on Windows 7 with Xampp.
I currently use a batch file that starts automatically with Windows, although it works correctly, I wish the command prompt window would not remain permanently visible, since the PC is used for other business stuff, and sometimes the user closes by error the window, stopping the socket server.
Of course, thank you very much for your answers and excuse my bad English.
There are several ways to start windows process without visible console window. First you could create windows service, some software support it natively or you could use utility like NSSM. Second: You could start program via task scheduler and tune task properties. Third: You could use utility like CHP to start program without console window. Remember one thing: If you start program without console window (and it is not a windows service), the only way to stop it is taskkill command or GUI Taskmanager.
To initialize the websocket server on a windows machine, without the command prompt just set autoexec.bat to halt_threads 2.

Is there a Mac App or command to autoconnect to SSH?

Right now I'm running a terminal with multiple tabs since I need to ssh into multiple servers to perform different tasks depending on the project. As I said I keep terminal up but it will eventually disconnect or some other hickup requiring me to either login back in or close and reopen terminal (and all my tabs/connections).
I'd like to either:
Open terminal type a command like "connect to webserver" and have it run the ssh command with password
Install an app that does this sort of thing and maybe has some extra functionality (not sure what that would be). Hopefully the app would auto connect and display windows for each connection I specify.
You should use vSSH Lite, Which is free for 2 tabs. Then you have to pay some amount.
Here is the link vSSH Lite

Open a window on windows server in a user desktop from the SYSTEM level cmd

I came across an issue that I'm not entirely sure it is even possible.
I want to start a process (chrome browser for ex.) on a user desktop using a system level command prompt or powershell.
I tried many imitations such as runAs and -Credentials but they only open the process in the background "as" the user, not on the user's desktop. I want to actually RDP to the user's profile and see the browser open.
I'm aware there are risks of using system. This question is mostly on how to start a process on a specific user desktop rather than just appearing on task manager.
Edit to clarify the issue:
I'm using windows server which has several of users, all of them are users that i have their name and password.
On that server, i have a process running under SYSTEM which i need it to open a process with a UI (a browser for ex.) in one of the other users's desktop.
The user's session is open and runnign and i can RDP/VNC/SSH/whatever to it and open whatever i want but that is not what i need. I want to RDP to that user after the browser was opened and see that it is already opened.

Selenium Grid, Capturing Screenshots

Capture screenshot using selenium command captureScreenshottoText or capture screenshot works fine if display/monitor is ON
But if Monitor is OFF it captures blank/Black images
How to get Proper images when display is off
This happens when the session is locked out or when the machine goes to sleep mode. Workaround that we use is to make sure that the machine never goes into this state. You can find more details here on how to disable the screen lock - http://www.howtogeek.com/howto/windows-vista/disableenable-lock-workstation-functionality-windows-l/
If you are connecting to a remote computer, use a VNC server/viewer to open your Selenium Server so that the display doesn't get killed. If you are using Remote Desktop, the display will close whenever you quit.
Connecting via VNC should fix your issues

Resources