0

Question 1: Is this how it's normally done?

Question 2: I've already tried it on Azure Web App with port 80 and I get "An attempt was made to access a socket in a way forbidden by its access permissions.", I thought maybe umm.. Firewall, but then I read about some restrictions I think.

Question 3: Is Azure even suited for that, and if not what is?

1 Answers1

0

If the need is to execute the .exe on the remote machine, below are the few ways:

  1. PowerShell
  2. CMD [using Ps Exec]
  3. RemoteExec - Encrypted software

1) PowerShell

You can execute any Windows PowerShell command on one or more remote computers using the WS-Management protocol. On distant computers, you can create permanent connections, begin interactive sessions, and execute scripts.

To run a command on one or more computers, use the Invoke-Command cmdlet provided by Microsoft..

Invoke-Command -ComputerName Server01, Server02 -ScriptBlock {Get-UICulture}

output:

LCID    Name     DisplayName               PSComputerName
----    ----     -----------               --------------
1033    en-US    English (United States)   server01.corp.fabrikam.com
1033    en-US    English (United States)   server02.corp.fabrikam.com

Run the.exe programme, play the game, then interact with extra commands on the remote computer to run the script, refer this Microsoft Detailed documentation of Windows PowerShell Remoting and this SO Thread gives you PowerShell execution commands overview through CMD on remote computer.

Sample code: (programatically):

using System.Diagnostics;
// ....
Process p = new Process();
p.StartInfo.FileName = @"c:\PsTools\psexec.exe";
p.StartInfo.Arguments = @"\\ibi20-pc -u ibi20 -p 12345 -i c:\windows\system32\notepad.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.Start();

If you need to run .exe in PowerShell located on remote client machine using release Pipeline Azure Devops, this SO Thread helps you.

2) CMD [using Ps Exec]

Using the PsExec tool, you can run apps and processes on distant machines and take advantage of all the interactive features of console applications.

The primary benefit of PsExec is its capacity to launch interactive command-line interfaces on distant computers, run applications remotely, and issue any commands (in the background, or the interactive mode).

One of the most used applications in the Sysinternals PsTools package is the PsExec utility. Simply transfer the PsExec utility to a folder on your computer (it is easiest to copy it to the default executable folder C:WindowsSystem32), and launch it using the PowerShell console or command prompt.

To connect using PsExec, use the following command:

psexec \\RemotePCName [-u username[-p password]] command [arguments]

Follow this documentation to proceed further steps for running .exe in the remote computer.


3) RemoteExec - A handy Encrypted Software:

This software solution, which is agentless and encrypted, enables you to:

Remotely run programmes, scripts, and associated files, or schedule them for a later date or time. Easily deploy MSI packages, Service Packs, patches, hotfixes, etc. and be instantly informed of the outcomes. change the registry settings, disable local accounts, copy, update, and remove files and folders remotely turn off, wake up, and reboot computers, lock or end user sessions, etc. There are a few additional methods, including Task Scheduler > Connect to Another Machine, Running.exe in another computer with C#, and other third-party applications.

PsExec and PowerShell allow admins to be able to execute system commands remotely, without too much pre-configuration or overhead.

The PsExec option is the best choice for new users because it is the simplest to learn, enables remote execution of CLI-based executables, and offers access to all features.