I have a script I have written that will open IE and do a screen cap, save it to a network share and then we use in on our digital signage. Problem is it works flawlessly from the ISE, but if I set it to run as a scheduled task it fails. Does not even open IE on the box running the script. I know it is running, because it does delete the old files as it should, but it doesn’t write the new files.
It works on your local workstation / server because you are logged into the box interactively and running script interactively.
So, PoSH is using your interactive user context to allow this.
While you are logged into your local workstation / server, have you set a ST and waited for it to trigger to see what happens, as part of your validation?
Have you set and ST on your local workstation / server, set it to fire after a few minutes, but locked the workstation / server and wait to see if it fires and gets you what you’d expect locally?
How do you have the ST / script setup?
What account are you trying use?
Are you saying, you leave the remote box always logged on and preventing the lock screen from ever running?
Are you saying you are using the identity of the logged on user to try and do this?
(due to Windows security boundaries, this is really not a thing btw)
If you are trying to use PoSH to run an interactive app remotely, that is really not what PoSH is for. That is where things like MS SysInternals, psexec and the like come into play, since that allows you to impersonate a user.
I found the problem, think I have it fixed now, but yes, had a ST set to run on another box, logged on, no one one it. Ran script at highest level, and the user account is an admin on the box. Problem was i set to run if not logged in, so it was not running in the foreground. I am open to better solutions, what I am trying to do is get a screen shot of a dashboard type web site that shows how our teams are doing, and then displaying the info on internal digital signage. So the Signage has no permissions to the websites, and I just looking to grab an image every 30 minutes or so and then place it as a JPG in a location the signage can get to. So right now my script opens browser, maximizes, grabs a screen shot, stores the capture and closes the browser, then moves on to the next site, I have 3 sites I do the same for.