Azure-Samples / Azure-Samples/DSRegTool

Localization Issue for proxy detection

Open
#9 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PowerShell
Stars
82
Forks
27
PR merge metrics
No merged PRs in 30d

Description

> Please provide us with the following information:
> ---------------------------------------------------------------

### This issue is for a: (mark with an `x`)
```
- [X] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
```

### Minimal steps to reproduce
> Run the script on a German OS (Option 3)

### Any log messages given by the failure
>
```
Start-ScheduledTask : Das Argument für den Parameter "InputObject" kann nicht überprüft werden. Das Argument ist NULL
oder leer. Geben Sie ein Argument an, das nicht NULL oder leer ist, und führen Sie den Befehl erneut aus.
In C:\Temp\DSRegTool-main\DSRegTool.ps1:1917 Zeichen:13
+ $Task | Start-ScheduledTask -AsJob -ErrorAction Stop | Wait-Job | ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Start-ScheduledTask], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Start-ScheduledTask
```

### Expected/desired behavior
>

### OS and Version?
> Server 2019

### Versions
>

### Mention any other details that might be useful

Proxy detection is not localized corectly.
Output of netsh winhttp proxy on a German OS is:
`DirectAccess (kein Proxyserver)`
In line 765 you check for:
`if ($global:ProxyServer -eq "Direct access (no proxy server)."){
$global:ProxyServer="NoProxy"
If($Write){Write-Host "Access Type : DIRECT"; Write-Log -Message "Access Type : DIRECT"}
}`

So on a German OS the Check results in:
`Invoke-WebRequest -uri 'https://login.microsoftonline.com/common/oauth2' -UseBasicParsing -Proxy http://DirectAccess (kein Proxyserver).).StatusCode`

As quick fix i changed ln 765 to:
`if ($global:ProxyServer -match "(.*no proxy server.*|.*kein Proxyserver.*)"){`
but this only fixes is on German OS, not other languages.
Maybe there is a better way to check proxy settings.

> ---------------------------------------------------------------
> Thanks! We'll be in touch soon.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.