I created a SSH Server on Windows 10 (Open SSH) and I'm connecting to it via my Phone with an app called Jucy SSH - it's secured with PKI and Passphrase. I log in with my "regular" user name.
Now what I want is to be able to launch a specific Program with elevated rights. I cannot launch it when navigating to said program.
In a regular cmd session I can launch the program using "C:\Program Files (x86)\program.exe" I can also run it with elevated rights using runas /user:Administrator "C:\Program Files (x86)\program.exe" It asks for a password but after entering it the program doesn't launch, in fact nothing happens.
Which is weird because I can launch notepad.exe from the ssh session.
and I can launch it from my PC with this powershell script:
function Start-ProcessAsAdministrator {
param (
[Parameter(Mandatory=$true)]
[string]$FilePath,
[string]$Arguments = ""
)
$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.FileName = $FilePath
$psi.Arguments = $Arguments
$psi.Verb = "runas"
$process = New-Object System.Diagnostics.Process
$process.StartInfo = $psi
try {
$process.Start() | Out-Null
}
catch {
Write-Host "Failed to start process with admin rights: $_"
}
}
# Now, use the function to start your program with admin rights
$programPath = "C:\Program Files (x86)\program.exe"
Start-ProcessAsAdministrator -FilePath $programPath
I can launch a Powershell session using powershell but I cannot execute the script due to a security violation.
What do I have to do to be able to launch a program with elevated rights using a Windows SSH session?