Passer au contenu principal

Activation du serveur proxy en PowerShell Windows 10

création du script avec les paramètres du Proxy :

 

ProxyOrange.ps1

Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\' -Name 'ProxyEnable' -value 1 -ErrorAction Stop
Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\' -Name 'ProxyServer' -value 'proxybkp.si.francetelecom.fr:8080' -ErrorAction Stop
Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\' -Name 'AutoConfigURL' -value 'http://proxypac.si.francetelecom.fr:8080/' -ErrorAction Stop
Write-Output "Le nouveau Proxy est le proxybkp.si.francetelecom.fr:8080"

 

création d'un script pour la désactivation du proxy

# Filename: ProxyDisable.ps1
# Requires an Elevated PowerShell

# Disable the Proxy (Global)
Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\' -Name 'ProxyEnable' -value 0 -ErrorAction Stop
Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\' -Name 'ProxyServer' -value '' -ErrorAction Stop
Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\' -Name 'AutoConfigURL' -value '' -ErrorAction Stop

#Set-InternetProxy -disable
Write-Output "=============== Le Proxy est maintenant inactif ================="