Invoke-WebRequest -Headers $headers -Method "POST" -Uri $uri -InFile $fileToAttach
In the above web request:
- $uri points to a public website.
- $fileToAttach points to a remote file share (Access via VPN).
- My connection is public internet (home internet), connected to above VPN to access the file share.
When I run this command, does the $fileToAttach download to my PC (in memory?) and then the file is sent to $uri? If not, what is the chain of events that happens?
CodePudding user response:
A quick test with Wireshark showed that Invoke-WebRequest
, in order:
- Starts a TCP connection to the destination server
$uri
- Loads the entire
-InFile
file from the remote server into memory, - Continues with the connection in 1, processing https/auth steps,
- Posts the file