Why won’t PowerShell start without an internet connection?

0
10
Asked By CuriousCat42 On

I'm running into a bizarre issue with PowerShell on my Linux machine. Whenever I disconnect from the internet, PowerShell scripts and even the command line interface won't run at all. Initially, I wrote a script that checks for connectivity to a specific server before executing commands on a remote host. To test this, I unplugged my internet connection, expecting a fail code to trigger—but surprisingly, the script didn't execute at all. I even created a simple 'hello world' script, which also failed to run.

If I start a script and then reconnect the internet, it continues to execute, but it just hangs when I'm offline. Typing `pwsh` into the terminal simply returns `PowerShell 7.5.3` without loading any further. It's the same situation with Visual Studio Code's integrated terminal; it freezes and doesn't load when the cable is disconnected. Can anyone explain why my PC needs an internet connection to run a simple script? I've made no recent network changes and just use a wired connection to a standard unmanaged switch connected to my router. (I'm on PowerShell version 7.5.3 and Fedora 42 with KDE.)

4 Answers

Answered By SimpleShell78 On

Have you tried launching PowerShell with `-ExecutionPolicy Bypass`? Just to check if that’s affecting your ability to run scripts without a connection?

TechieTom87 -

Just to clarify, using `-ExecutionPolicy Bypass` usually helps with permissions but might not fix the connection issue.

Answered By ShellSeeker21 On

It could be a timeout problem where PowerShell is looking for a connection before it launches anything. Some older versions had issues with hanging on startup due to network dependencies. If you haven’t already, disable telemetry and update checks to see if that helps!

CuriousCat42 -

I left it hanging for about 15 minutes. I've disabled all the telemetry and checks I could find, but still no luck.

Answered By TechieTom87 On

This sounds like PowerShell might be trying to check for expired certificates or some external dependencies during startup. You could look into your profile settings by running `get-content $profile` when you’re online. It might give clues about what's causing the hang. Let me know if you get any insights from that!

CuriousCat42 -

Thanks for your suggestion! I checked when I was connected, and it says the profile does not exist. Not sure if that's relevant since I can't even run it offline.

Answered By UnixGuru33 On

I ran into a similar issue, but I was able to load PowerShell without a network connection. It sounds like you might have some settings or modules that are expecting a connection. Try running `pwsh -NoProfile` and see if that changes anything for you!

CuriousCat42 -

I gave that a shot, and unfortunately, it still just hangs at `PowerShell 7.5.3`. Can't seem to execute anything.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.