While accessing a Windows Pro VM via Remote Desktop, I can successfully run a batch file in Powershell by navigating to the folder and running ".\batchfile.bat" which contains:

"C:\Program Files\Internet Explorer\iexplore.exe" "https://name.of.websitein.url.com?param=xyz"

There is a ClickOnce app (associated with the Windows user for security) that is run with this batch file. The parameter launches the app silently and updates a log file with downloaded information. When it works, it opens IE, downloads a file, close IE, opens the app and runs the command, then closes the app.

If I remote into the Windows machine via SSH from a Linux machine, the command prompt in SSH is Powershell. But if I try to run the batch file, it only shows Internet Explorer in the Task Manager. Nothing else happens and I have to end the task manually. If I do "$out = .\batchfile.bat" there is no output to read.

I have attempted: all various sorts of Invoke-Command, "cmd.exe", etc. All same results. I would like to prompt the normal behavior of the batch file if the user is logged in, or when account is locked. I am generally attempting this approach after endless failed attempts to run via Task Scheduler (Where it said it ran fine, but nothing actually happens).

How can a Linux machine interactively run commands as a user on a Windows machine in order to execute a script involving a ClickOnce app?

  • As for this...[While accessing a Windows Pro VM via Remote Desktop, I can successfully run a batch file in Powershell by navigating to the folder and running ".\batchfile.bat"]... and it should since you are logged in interactively with your profile. PowerShell natively does not allow you to run code in the context of the logged-on user. It is a Windows Security boundary. You'd have to use say PSExec ot the like to do that. If you are using a SchedueldTask for thios that is marks as run only when the user is logged-on, then there is no reason for SSH or remoteing at all. Just run PS as normal.
    – postanote
    Sep 7, 2020 at 23:09
  • Is it possible to use PSExec from the same machine or only remotely? I am running SSH from a Linux machine. The Task Scheduler does not appear to work when set to "Run whether user is logged in or not". Seems to be a common problem. I would not use Windows otherwise, but the app that needs to be scheduled is Windows-only. I will need to find a method of interactive script-running, prompted by a remote connection from a Linux machine. I will update the question to include this. Thanks for the suggestion.
    – gboone
    Sep 9, 2020 at 0:48

1 Answer 1


I spoke with the ClickOnce app's developers - they claim a Windows 10 update recently caused the Task Scheduler to no longer work. Left with no other options...

...in the spirit of 90s computing I decided to use TinyTask with TaskScheduler to run a macro.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.