Search code examples
powershellbackground-process

How to pull the background process to the interface in Windows?


I'm using PowerShell to execute a .exe (installation file) file in a remote computer from my computer, I could see that the process is triggered from my computer and can see the process run in the remote computer but it's running as a background process.

$COMPUTERNAME = "XXX"
$san = New-PSSession -ComputerName $COMPUTERNAME -Credential YYY
Invoke-Command -Session $san {
    C:\users\Desktop\zzz.exe
}

I can't bring it front to the interface.

Can someone help?


Solution

  • I know this is very old. I was looking for the same thing and found this unanswered.

    Log into the computer XXX using RDC or local console. You can confirm sessions by running: qwinsta

    Change your script (for testing) to use the same session ID

    SESSIONID = your session ID
    psexec IPADDRESS -u USERNAME -p PASSWORD -i SESSIONID -d "C:\users\Desktop\zzz.exe"