If PowerShell cannot reach the internet or a remote PowerShell endpoint, split the problem into three buckets: local connectivity failure, proxy or firewall blocking, or access to a remote PowerShell endpoint. The quickest check is a plain DNS test and an HTTPS test from PowerShell, because that shows whether the break starts on the machine or later in the path.
Why isn't PowerShell connecting?
Start with the simplest layer and move upward. PowerShell may be fine, but the PC may have no working internet, the proxy path may be wrong, or the target service may require a different module, runtime, or connection cmdlet. A clean command sequence shows which layer failed.
Likely causes, ranked
- Local network failure. DNS, routing, or a dead link can stop every outbound call.
- Proxy, VPN, or firewall blocking. PowerShell can use proxy settings for outbound connections, but remote-session commands may need to be told which proxy path to use.
- Wrong runtime or module. Windows PowerShell and PowerShell 7 are different runtimes, and Microsoft 365 tasks often depend on the ExchangeOnlineManagement module.
- Remote endpoint access issue. Exchange Online and Security & Compliance PowerShell use specific connection cmdlets and cloud-specific endpoints.
- Check local reachability. Run
Test-NetConnection www.microsoft.com -Port 443andResolve-DnsName www.microsoft.com. If both fail, stop troubleshooting PowerShell and fix the PC or network first. - Confirm the runtime path. Run
$PSVersionTable.PSVersionand(Get-Process -Id $PID).Path. The Microsoft-signedpowershell.exepath is usuallyC:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe; PowerShell 7 uses a different executable. - Check the target module. Run
Get-Module ExchangeOnlineManagement -ListAvailable. If the module is missing or old, import or update it before testing Exchange Online or Security & Compliance PowerShell.
Picture a laptop that can browse websites but fails only when you run a Microsoft 365 connection command. That usually points away from the local network and toward the module, auth path, or endpoint settings. A different case is a PC that fails Resolve-DnsName for every host, which points to a machine-level network problem, not a PowerShell problem.
Is the internet actually down?
If the machine cannot resolve names or reach an HTTPS site, PowerShell is not the part that is broken. Test name resolution and a basic 443 connection first, then restart the network adapter, the PC, or the router if the checks fail after a power outage or reconnect event.
- Run DNS and HTTPS tests. Use
Resolve-DnsName www.microsoft.comandTest-NetConnection www.microsoft.com -Port 443. A working machine should return resolved addresses andTcpTestSucceeded : True. - Retry on another network. Run the same two commands on a different Wi-Fi or wired network. If they work there, the local router, ISP, or network policy is the likely problem.
- Refresh the session. Close PowerShell and reopen it, then rerun the same commands. If the PC just recovered from a power outage, a stale adapter or session can keep old state until you reconnect.
After a power outage, a router may hand out a bad DNS server or an incomplete lease. That creates a pattern where web pages load slowly or not at all, and PowerShell commands that depend on name resolution fail for the same reason.
Are proxy settings blocking it?
If local internet works but PowerShell cannot reach the target, check proxy behavior next. PowerShell outbound calls can honor Windows proxy settings, and remote-session commands may depend on the connection path. On managed networks, a bad proxy mode can fail while local browsing still appears normal.
- Inspect the WinHTTP proxy. Run
netsh winhttp show proxyfrom a PowerShell window. If the machine is behind a proxy and this showsDirect accesswhere a proxy is expected, outbound sessions may fail. - Test the proxy modes. Run
$s = New-PSSessionOption -ProxyAccessType IEConfig, then retry the connection command that failed. If that does not work, repeat withWinHttpConfigandAutoDetectto see which path the machine can actually use. - Add the session option. Use
-PSSessionOption $swith the connection cmdlet for the target service. That ties the PowerShell session to the proxy path instead of leaving it to guess.
Say your office network requires a browser proxy but WinHTTP is set differently. In that case, PowerShell may fail while a web browser still works. The fix is to pass the right session option and rerun the same command.
Is the endpoint or module the issue?
If the machine has internet and the proxy path is correct, the remaining fault is often the service connection itself. For Microsoft 365 tasks, use the module and cmdlet for the exact service: Exchange Online uses the ExchangeOnlineManagement module, and Security & Compliance PowerShell uses Connect-IPPSSession.
Exchange Online connection checks
Exchange Online connections use the ExchangeOnlineManagement module and modern authentication. Version 3.9.0 or later is required for some eDiscovery cmdlets, and some app-only automations may require version 3.10.1 or later. If the module is older, update it before blaming the network. (Microsoft Learn)
- Load the module. Run
Import-Module ExchangeOnlineManagement. If the command fails, the module is missing or blocked from loading. - Check the version. Run
Get-Module ExchangeOnlineManagement -ListAvailable | Select-Object Name,Version. If the version is below 3.9.0 for eDiscovery work or below 3.10.1 for some app-only automations, update before retrying. - Retry the connection. Run
Connect-ExchangeOnlineor the Exchange Online connection command your workflow requires. If the session opens but the specific task fails, the module version or command syntax is the next place to look.
Security & Compliance PowerShell checks
Connect-IPPSSession is the connection cmdlet for Security & Compliance PowerShell. It supports -EnableSearchOnlySession for eDiscovery cmdlets, and it also supports -ConnectionUri, -AzureADAuthorizationEndpointUri, and -PSSessionOption. Use the right parameters for the cloud you are targeting.
- Use the right session type. Run
Connect-IPPSSession -EnableSearchOnlySessionwhen your task is eDiscovery-related. The switch is required for those cmdlets. - Set the cloud URI. Pass
-ConnectionUriand-AzureADAuthorizationEndpointUriexplicitly. Microsoft 365 and Microsoft 365 GCC can use the default compliance PowerShell URI, while GCC High, DoD, and Office 365 operated by 21Vianet may use different values. - Add the proxy option. If the network uses a proxy, include
-PSSessionOption $swhere$scomes fromNew-PSSessionOption -ProxyAccessType IEConfig,WinHttpConfig, orAutoDetect.
Suppose a tenant in GCC High connects with the default Microsoft 365 URI. The command may fail even though the internet is fine. The fix is to pair the session cmdlet with the cloud-specific connection and authorization endpoints, then retry the same action.
PowerShell connection troubleshooting matrix
This matrix separates local internet failure, proxy trouble, and remote service access. Use the command in the row that matches the symptom you see, then follow the next action only if the expected result does not appear.
| Symptom | Likely layer | One PowerShell test command | Expected result | Next action |
|---|---|---|---|---|
| General websites and PowerShell both fail | Local network | Test-NetConnection www.microsoft.com -Port 443 |
TcpTestSucceeded : True |
Fix DNS, adapter, router, or ISP issues first. |
| Exchange Online connection fails, but internet works | Auth or module | Get-Module ExchangeOnlineManagement -ListAvailable | Select-Object Name,Version |
Module present and current enough for the task | Run Import-Module ExchangeOnlineManagement, then retry with the correct Exchange Online command. |
| Security & Compliance PowerShell fails on eDiscovery work | Endpoint or session type | Connect-IPPSSession -EnableSearchOnlySession |
Session connects cleanly | Set -ConnectionUri and -AzureADAuthorizationEndpointUri for the target cloud. |
| PowerShell works on one network but not behind the office proxy | Proxy | $s = New-PSSessionOption -ProxyAccessType AutoDetect |
Session uses the proxy path that matches the environment | Retry with IEConfig and WinHttpConfig if AutoDetect fails. |
What if PowerShell is being blocked?
If a PowerShell window opens or fails in a way that does not match the network test results, check whether another process launched it. Outbound PowerShell can be blocked by security tooling, so the parent process and the command line matter. That is especially useful when a scheduled task, startup entry, installer, or browser copy-paste launched the session.
- Inspect the parent process. Run
Get-CimInstance Win32_Process -Filter "ProcessId=$PID" | Select-Object ParentProcessId,CommandLine. Then inspect the parent PID with the same class to see what started PowerShell. - Review the command line. Look for a copied one-liner, a quoted path with special characters, or an unexpected script location. Re-type the command directly in the console if the parser may have broken the original text.
- Start a clean session. Open a new PowerShell window and rerun only the minimum connection command. If that works, the original launcher or security tool is the likely blocker.
A common first-timer mistake is pasting a long command from a web page into a scheduled task action. If the path contains spaces or an apostrophe, the launcher can break the string before PowerShell ever reaches the network.
Still not working?
If the basic tests pass but the target still fails, collect evidence and hand it to the admin or service owner. The useful set is small: the exact command, the module version, the endpoint URI, the proxy mode, and the full error text. That lets someone compare the failing layer against policy or tenant settings quickly.
- Save the exact command. Copy the full command line, including
-ConnectionUri,-AzureADAuthorizationEndpointUri, and-PSSessionOptionif used. Small syntax differences matter here. - Record module details. Run
Get-Module ExchangeOnlineManagement -ListAvailable | Select-Object Name,Versionand keep the output with the error text. - Escalate the target path. If local internet, proxy, and module checks all pass, move the issue to tenant policy or endpoint access review. At that point the problem is no longer a general PowerShell connectivity issue.
Frequently asked questions
Why is powershell not working?
Check the runtime path first, then the network. Run (Get-Process -Id $PID).Path and Test-NetConnection www.microsoft.com -Port 443. If the path points to the expected Microsoft-signed executable and the network test fails, the issue is below PowerShell. If the test passes, move to the module or endpoint command.
Can't connect to internet after power outage
Run Resolve-DnsName www.microsoft.com and Test-NetConnection www.microsoft.com -Port 443. If both fail after a power loss, restart the router and the PC, then repeat the same commands. A bad lease or DNS server choice is common after a sudden power cut.
Why wifi is not getting connected
Use PowerShell to separate Wi-Fi association from internet access. If the adapter shows connected but Resolve-DnsName still fails, the Wi-Fi link is not the only issue. Test on another network or adapter path before changing PowerShell commands.
Why does my pc not connect to internet?
Run a DNS test and an HTTPS test before looking at PowerShell. Resolve-DnsName www.microsoft.com and Test-NetConnection www.microsoft.com -Port 443 tell you whether the PC has working name resolution and outbound access. If both fail, fix the machine or network first.
Powershell cannot connect to internet
Use Test-NetConnection to see whether the failure is local or service-specific. If the command reaches external sites but a Microsoft 365 connection fails, the module, proxy, or endpoint settings are the real problem. If the command fails everywhere, the issue is local networking.
Powershell check if connected to internet
Run Test-NetConnection www.microsoft.com -Port 443 for a quick connectivity check, and Resolve-DnsName www.microsoft.com for name resolution. A working result from both commands is a better indicator than opening a browser tab, because it is a quick local test of connectivity from PowerShell.
Powershell not connecting to exchange online
Check the module and the command together. Run Get-Module ExchangeOnlineManagement -ListAvailable | Select-Object Name,Version, then connect with the right Exchange Online cmdlet and current module. If the version is below 3.9.0 for eDiscovery work or below 3.10.1 for some app-only automations, update first.