I am running into issues running subsequent invoke-webrequests.
Say I open the ISE for the first time and run the code below, I get the correct output in a few milliseconds.
Elapsed : 00:00:00.1780360
The See code below.
$timer = [Diagnostics.Stopwatch]::StartNew()
$ProgressPreference = 'SilentlyContinue'
$resp =""
$resp =Invoke-WebRequest -uri 'https://www.canada.ca/en/immigration-refugees-citizenship/news/2023/07/minister-fraser-to-make-an-important-announcement.html' -UseBasicParsing
$ProgressPreference = 'Continue'
$timer.stop
$timer
Can anyone explain to me what is going on ? Is it simply that the initial Webrequest hasn't finished (even though I have the output) ?
I've tried removing the Progress preference as discussed on other threads but to no avail.
However, closing and reopening the ISE will solve the issue without fail.