Forum Discussion
oldyguy
Jun 11, 2022Copper Contributor
Is it possible to launch a browser with task scheduler as system account?
Hi everyone, I hope you can help:
Is it possible to launch a browser,
to open a web page that works in get mode
using powershell on task scheduler,
running as system account to avoid screen updating,
every time any user is logging in,
and then, after the url responds,
close the browser gracefully (other than killing it)?
- Does it really need to open the browser?
Can you use Invoke-WebRequest directly from PowerShell?
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.2
- "that works in get mode using powershell on task scheduler" You have to give some more detail, do you wnat to download/invoke something when a user logs in? You can start things at user login, but not as system login...
- oldyguyCopper Contributorok, I know what do I need, but how to do it... I'll try to clarify the scenario:
1) use task scheduler whenever a user logs in, to run powershell minimized or hidden
2) powershell must get some data
3) powershell must launch a browser minimized or hidden
4) browser must point to an url that runs in get mode (https://...?data1&data2...)
5) browser must be terminated gracefully (not being killed or abandoned)
6) use system account to avoid password change issues if possible
Actually, this is what I got:
1) done, except by running minimized or hidden
2) done
3) browser launch done, but not minimized or hidden
4) done
5) I need help to:
a) get hwnd in start-process
b) set its window size to a minimum or better yet, hidden
c) send keys (%{F4}) or better yet, a message to close browser
6) donĀ“t know if it works
if something needs clarification, please let me know.
- Newbie_JonesBrass ContributorDoes it really need to open the browser?
Can you use Invoke-WebRequest directly from PowerShell?
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.2- oldyguyCopper Contributorhi Newbie_Jones it looks promising... I'm starting to think I'm reinventing the wheel because I'm a rookie on all this web mumbo-jumbo
I'll post my results asap, thx a lot.- oldyguyCopper Contributorhi Newbie_Jones & Harm_Veenstra, I'm glad to report that Invoke-WebRequest did the job as a charm and I'm about to finish my project, thank you for your help!