How can a PHP script on PC A execute a PowerShell script on PC B via a web interface?

To execute a PowerShell script on PC B from a PHP script on PC A via a web interface, you can use the `ssh2_exec` function in PHP to establish an SSH connection to PC B and run the PowerShell script remotely. You will need to have SSH enabled on PC B and proper authentication set up for the connection.

$connection = ssh2_connect('PC_B_IP', 22);
ssh2_auth_password($connection, 'username', 'password');

$stream = ssh2_exec($connection, 'powershell.exe -File C:\path\to\script.ps1');
stream_set_blocking($stream, true);
$output = stream_get_contents($stream);

echo $output;

ssh2_disconnect($connection);