Welcome Forums General PowerShell Q&A Invoke-WebRequest

This topic contains 3 replies, has 3 voices, and was last updated by

5 years, 7 months ago.

  • Author
  • #10541

    Topics: 12
    Replies: 20
    Points: 0
    Rank: Member


    I've been playing with Invoke-WebRequest, to write a very simple 'soak test' for some of our web services. I've noticed some very strange behavior when I'm running this, see screen shot attached.

    Any ideas why Powershell is throwing a popup notification?

    Import-Module WebAdministration
    $cred = Get-Credential
    ri output.csv -Force
    1..1000000 | %{
    	Invoke-WebRequest -Uri "https://myhost:1443/Service/rest/Get?ProductTypeFilter=abc&Key=7007009&BlobTypeFilter=Sales&MaxNumOfBlobs=10" -Credential $cred | select -ExpandProperty content | %{Write-Output "myhost:1443 `t $_"} | Out-File output.csv -Append 



  • #10547

    Topics: 0
    Replies: 669
    Points: 0
    Rank: Member

    Hi – the screen shot isn't clear – its not fully visible – but it seems to be some kind of progress bar. Can you supply a clearer screen shot?

    How much data are you expecting to be returned?
    Do you get the same issue with all calls to the service?

  • #10576

    Topics: 12
    Replies: 20
    Points: 0
    Rank: Member

    This only seems to occur when I'm running requests in a quick fashion. In this example it's probably doing about 7-9/second, and the popup doesn't stay long enough to get a good screen shot. The amount of data returning is very small less than 50kb..But regardless, even if the data was 1GB, there shouldn't be a popup status window should there?

    As a side note, if I run this while RDP'd into the server hosting the web service i get this second image "perf2.jpg" which I would expect ( I guess ).

    Maybe this is a Windows 7 thing?

  • #10580

    Topics: 13
    Replies: 4872
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    That "pop up" is a PowerShell progress bar, and its an inbuilt part of the Web-Request command. You can probably set $ProgressPreference='SilentlyContinue' to suppress that.

    The pop-up is rendered by the host application. So, when you're in the console host, it's a character-based pseudo-pop-up-thing. I suspect the first time you were using the ISE or some other "graphical" host, which renders the progress as an actual dialog.

The topic ‘Invoke-WebRequest’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort