Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Need help with invoke-webrequest cmdlet

$
0
0

hi all,

I am trying to use powershell cmdlet invoke-webrequest to access a website that goes to "sleep" after about minutes, and I am trying to write a script using powershell to access the site like every 10 minutes to keep it alive in cache.

this is what I got so far but it's not working for some reason and it's more around the format of the user name and password, because I have to use UNP:

PS C:\> $r = Invoke-WebRequest https://www.DomainName.com/
$r.Forms[0].Name = "UserName@DomainName.com"
$r.Forms[0].Password = "MyPassword"
Invoke-RestMethod https://www.DomainName.com -Body $r

any ideas on how to make this work?

Thanks in advance.


Mohsen Almassud


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>