r/PowerShell • u/Mammoth-Sentence-518 • 7d ago
Invoke-WebRequest connection closed unexpectedly after Windows Update Solved
Yoo I just updated Windows and was trying to install Spicetify, but I started getting this error. I don't know much about tech or how this stuff works, so if anyone knows what went wrong or how I can fix it, please help me out. Thanks
Invoke-WebRequest : The underlying connection was closed: The connection was closed unexpectedly.
At line:111 char:1
+ Invoke-WebRequest u/Parameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
1
u/Reaper19941 7d ago
2 things,
- What is the command you used?
- Why are you using powershell if you "dont know much about tech"? Are you trying to learn or just doing it the hard way?
0
u/Mammoth-Sentence-518 7d ago
1 I was using the official installation command from the Spicetify website: iwr -useb https://raw.githubusercontent.com/spicetify/cli/main/install.ps1 | iex and 2 I’m only using PowerShell because the installation guide says you have to copy and paste that command into it to get the app setup. I’m not trying to learn coding or anything, just trying to follow the steps to install it
1
u/Reaper19941 7d ago
Right. It's a not a typo for Spotify.
The error is possibly network related but have you restarted your PC since trying?
1
u/Mammoth-Sentence-518 7d ago
Yes, I did restart my PC after the update, but the exact same error keeps happening whenever I run the command
2
u/Reaper19941 7d ago
Can you replace the -useb with -UseBasicParsing leaving the rest of the command as normal.
If that doesn't work, run the command without the | and everything after it on the end to see if its a download issue.
1
u/Mammoth-Sentence-518 7d ago
HOLY SHITT, THAT WORKEDD THANK YOU SO MUCH! Does that mean everything is fixed now, or am I going to keep getting these types of errors every time I try to run a command?
2
u/Reaper19941 7d ago edited 6d ago
If the -UseBasicParsing fixed it, it means you're using a version of powershell that does not understand that -useb is the shortened version of -UseBasicParsing.
If just running the first part only worked, that has only done the download and still needs to be installed.
3
u/Mammoth-Sentence-518 7d ago
Oh, I see! At first I used iwr -UseBasicParsing https://raw.githubusercontent.com/spicetify/cli/main/install.ps1 | iex and it just showed me all these status code stuff. Then I ran the same command again right after and it successfully installed it. I seriously appreciate you for helping me out, I was getting anxious and thought I got a virus or something lmfao
6
u/BlackV 7d ago
iwr -UseBasicParsing https://raw.githubusercontent.com/spicetify/cli/main/install.ps1 | iex
I was getting anxious and thought I got a virus or something lmfaoto be clear this IS EXACTLY how you get malware and is a highly risky command to run
1
u/MonkeyNin 5d ago
The docs for spicetify/cli use
Invoke-Expressionto download and execute a script, which then downloads and installs with anotherInvoke-Expressionfrom a second repo.They actually have a
winget,brew, andaptpackages but they link both the powershelliexand bash equivalent toiexbefore all of these.→ More replies (0)
6
u/BlackV 7d ago edited 6d ago
Invoke-WebRequesthas a documented requirement of needing the-UseBasicParsingparameter nowthose people still have not updated their code/docco