I have a url that executes lots of javascript code. I want to open this from PowerShell to schedule.
But as it executes javascript code, PowerShell not opening this url properly.
What I tried?
Invoke-RestMethod -Uri "myurl"
Invoke-WebRequest -Uri "myurl"
both gives me error.
Invoke-RestMethod : My Apps
--> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date());gtag('config', 'UA-123456789-2'); At line:1 char:1+ Invoke-RestMethod -Uri "http://spos.rkapps.in/SendLCNotifyMails" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Note: Start-Process "myurl" runs as expected, as it opens a real browser but I want to schedule this when my server is on logoff mode so it does not runs.
How to open it?