microsoft / microsoft/CSS-Exchange

[Issue] Confirm-ProxyServer does not work on Powershell 7

Open
#2,065 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue
Dominant language
PowerShell
Stars
1.3k
Forks
395
Avg merge
14h 7m
Merged PRs (30d)
5

Description

Describe the issue

The Confirm-ProxyServer shared function always fails on PowerShell 7. Run any script with -Verbose and observe:

Calling Confirm-ProxyServer
Proxy server configuration detected
Unable to check for proxy server configuration

On PowerShell 7, this line throws, so we always end up in the catch:

image

GetSystemWebProxy() is deprecated and there is a new way to do this: https://github.com/dotnet/runtime/issues/24756#issuecomment-519618435

[System.Net.Http.HttpClient]::DefaultProxy.GetProxy("foo")

However, that doesn't work in Windows PowerShell.

Not clear if we should fix this or just let it continue to work this way. In PS7 we will never try to use a proxy. This apparently didn't cause an issue for customers running CVE-2023-23397.ps1. I know we had some using PS7 when running against Exchange Online.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the shared Confirm-ProxyServer function and reproduce the failure by running a script with -Verbose on PowerShell 7. Compare the Windows PowerShell behavior of GetSystemWebProxy() with [System.Net.Http.HttpClient]::DefaultProxy.GetProxy("foo"), then verify that proxy detection works appropriately in both PowerShell versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
networking, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.