Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Suggestion - Add proxy support

Abierto
#490 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
powershell

Línea de trabajo

Comienza con el script Prereq e inspecciona sus llamadas a Invoke-WebRequest, Install-PackageProvider y Find-DscResource/Save-Module. Determina cómo deben proporcionarse la configuración del proxy y las credenciales, y luego verifica que la instalación de los módulos necesarios funcione a través de un proxy sin requerir una configuración manual fuera del script.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

I was behind a proxy here and I had to change the script to add "-Proxy $Proxy -ProxyCredential $MyCreds" at the end of each "Invoke-WebRequest" cmdlet.

Same thing for "Install-PackageProvider -Name NuGet"

But then, i got error with "Find-DscResource -moduleName $modulename -RequiredVersion $moduleversion | Save-Module -Path "$PSScriptRoot\Temp\DSC"

I've search a long time and try these configuration without success :

Setting TLS 1.2 : [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Bypassing the certificate validation : [Net.ServicePointManager]::ServerCertificateValidationCallback = {$true};
Bypassing the certificate validation by code instead of block :
#C# class to create callback
$code = @"
public class SSLHandler
{
public static System.Net.Security.RemoteCertificateValidationCallback GetSSLHandler()
{

    return new System.Net.Security.RemoteCertificateValidationCallback((sender, certificate, chain, policyErrors) => { return true; });
}

}
"@
#compile the class
Add-Type -TypeDefinition $code

#disable checks using new class
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = [SSLHandler]::GetSSLHandler()

No success!! but then i've found way to configure default proxy but i wasnt able to add it to the script, and I had to install the module outside of the "Prereq" script. here what I use for this to work :

$proxy = 'YER PROXY HERE' # update this
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
[system.net.webrequest]::defaultwebproxy = new-object system.net.webproxy($proxy)
[system.net.webrequest]::defaultwebproxy.credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
[system.net.webrequest]::defaultwebproxy.BypassProxyOnLocal = $true

Install-PackageProvider -Name nuget -Scope AllUsers -Confirm:$false -Force -MinimumVersion 2.8.5.201
Register-PSRepository -Default -verbose

Install-Module -Name xActiveDirectory -Scope AllUsers -Confirm:$false -Force
Install-Module -Name xDHCpServer -Scope AllUsers -Confirm:$false -Force
Install-Module -Name xDNSServer -Scope AllUsers -Confirm:$false -Force
Install-Module -Name NetworkingDSC -Scope AllUsers -Confirm:$false -Force
Install-Module -Name xPSDesiredStateConfiguration -Scope AllUsers -Confirm:$false -Force

Probably there more "code head" people who can help with this since it's ugly but working :)

Thanks again for the great script!

Lenguaje dominante
PowerShell
Estrellas
1.3k
Forks
304
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/MSLab

Todos los issues de microsoft/MSLab

Issues similares

Más issues de DevOps

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.