When requesting https://aka.ms/win32-x64-user-stable in browser, it returns this filename "VSCodeUserSetup-x64-1.27.2.exe" to be saved.
I want to get this same info "VSCodeUserSetup-x64-1.27.2.exe" so I tried:
$webRequest = [net.WebRequest]::Create("https://aka.ms/win32-x64-user-stable")
$test = $webrequest.GetResponse()
But I'm getting error:
Exception calling "GetResponse" with "0" argument(s): "The underlying connection was closed: An unexpected error occurred on a send."
Is it the right method or what else ?
I don't understand why because I followed https://learn-powershell.net/2011/02/11/using-powershell-to-query-web-site-information/ and there is no arg given for GetResponse.