Zhorn Software
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Go down
avatar
Richard
Posts : 2
Join date : 2021-05-07

launch Caffeine on a remote pc using powershell Empty launch Caffeine on a remote pc using powershell

Fri May 07, 2021 7:03 pm
I have some Windows 10 devices that go to sleep after a while even though they're set to stay alive. I was trying to get around this by creating a Powershell script that would copy caffeine64.exe to the target computers and launch. I've tried a bunch of variations on the INVOKE-COMMAND method and I don't get an error, just nothing happens. The two bits of script that I'm talking about are as follows:

       Robocopy "C:\temp\Scripts\Richard\Caffeine" "\\$computer\C$\temp\" caffeine64.exe /copyall /z /r:2 /w:5
       Invoke-Command -ComputerName $computer -ScriptBlock {& 'C:\temp\caffeine64.exe'}

Like I said I've tried a few different variations and I don't get an error, just nothing happens. I've tried editing the file permissions on the host end but that doesn't seem to make a difference. What am I missing?
Admin
Admin
Admin
Posts : 532
Join date : 2018-03-30
Location : London
http://www.zhornsoftware.co.uk

launch Caffeine on a remote pc using powershell Empty Re: launch Caffeine on a remote pc using powershell

Thu May 27, 2021 4:34 pm
Caffeine needs to run in an interactive session.  I think - and I'm not sure as this is further into the depths of Windows than I know - that Caffeine will start in your above example, but the "keypresses" will go nowhere as they're not running in the desktop session.

It's a guess, but perhaps the -stes command line might help.  Perhaps.

Otherwise, you need to get the app started in the logged-on session.  Perhaps doing something with the Task Scheduler, adding a task to run as the logged-in user, might be able to achieve that?

Tom
avatar
Richard
Posts : 2
Join date : 2021-05-07

launch Caffeine on a remote pc using powershell Empty Re: launch Caffeine on a remote pc using powershell

Wed Jun 02, 2021 11:19 pm
Unfortunately as expected that didn't work. I may need to find another workaround. I was hoping to drop in Caffeine when I needed to run updates and remove when I was done. So I can't really set it up to run automatically.

Thanks for the response!
Sponsored content

launch Caffeine on a remote pc using powershell Empty Re: launch Caffeine on a remote pc using powershell

Back to top
Permissions in this forum:
You can reply to topics in this forum