I have a network device with a status page accessible by a Java applet. Using Fiddler I was able to find an http feed of the status, but the page has a constant refresh. (Firefox displays the page but keeps refreshing, Chrome sees it as an extension-less file and tries to save it but never finishes as there is always more data.)
The status page uses NTLM authentication so I though I would use an Invoke-Webrequest. The following code logs in and starts downloading the page but as its a constant data stream never finishes:
$url = "http://xxx.xxx.xxx.xxx/api/notify"
$user = "user"
$pass= "password"
$secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($user, $secpasswd)
$data = Invoke-restmethod $url -Credential $credential
Is there a way to escape from an Invoke-Webrequest after receiving a certain number of characters? Or is there a better way to do this?