Activer/desactiver fichier de conf auto (proxy.pac)

ptitben95 Messages postés 1 Date d'inscription jeudi 22 septembre 2005 Statut Membre Dernière intervention 30 avril 2009 - 30 avril 2009 à 20:08
fabinou61 Messages postés 2 Date d'inscription mardi 12 mai 2009 Statut Membre Dernière intervention 22 février 2011 - 22 févr. 2011 à 16:13
bonjour a tous,

je cherche en fait deux script.un me permettant d'un double clic, d'activer l'utilisation du fichier de conf auto (proxy.pac)dans IE
l'autre sciprt faisant l'inverse.

je suis sur que c'est possible mais je suis pas devolloppeur (bon d'accord j'ai un peu honte) et je trouve pas(et pourtant j'ai vraiment chercer, google est ton amie qui disait).
 
au secour

merci

2 réponses

fabinou61 Messages postés 2 Date d'inscription mardi 12 mai 2009 Statut Membre Dernière intervention 22 février 2011
22 févr. 2011 à 16:08
Bonjour,

Voici 2 scripts l'un pour activer le proxy et le second pour l'enlever.

---------------------------------------------------------
---------------------------------------------------------
Proxy_ON:

' On Error Resume Next
'paramétrage des paramètres du Proxy
'
set regmod = CreateObject("WScript.Shell")
'Donne l'adresse à utiliser
'
regmod.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\AutoConfigURL","http://proxy/proxy.pac","REG_SZ"

'Dit au navigateur d'utiliser le proxy défini
'
regmod.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable",1,"REG_DWORD"
'
'
Set objNetwork = CreateObject("Wscript.Network")
' 1. Récupération du nom de l'utilisateur
strUserName = objNetwork.UserName
'
'
'affichage boîte d'informations
'
Set WshShell = WScript.CreateObject("WScript.Shell")
intButton = WshShell.Popup (strUsername & ", le Proxy réseau est prêt", , "Internet Explorer - Proxy ON", "64")
'

----------------------------------------------------------
----------------------------------------------------------

Proxy_Off:

On Error Resume Next
'paramétrage des paramètres du Proxy
'
set regmod = CreateObject("WScript.Shell")
'Donne l'adresse à utiliser
'
'Dit au navigateur d'utiliser le proxy défini
'
regmod.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\AutoConfigURL","","REG_SZ"
'
regmod.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable",0,"REG_DWORD"
'
Set objNetwork = CreateObject("Wscript.Network")
' 1. Récupération du nom de l'utilisateur
strUserName = objNetwork.UserName
'
'<<<<<<<DESACTIVER FIREWALL>>>>>>>>
on error resume next

Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile

objPolicy.FirewallEnabled = FALSE

'affichage boîte d'informations
'
Set WshShell = WScript.CreateObject("WScript.Shell")
intButton = WshShell.Popup (strUsername & ", le Proxy est désactivé", , "Internet Explorer - Proxy OFF", "64")

J'espère qu'il est pas trop tard...

A plus
0
fabinou61 Messages postés 2 Date d'inscription mardi 12 mai 2009 Statut Membre Dernière intervention 22 février 2011
22 févr. 2011 à 16:13
Bonjour,

J'aurais besoin d'un ou deux conseils par rapport a mon fichier proxy.pac. Tout d'abord est-il correct? Je pense qu'il pourrait être amélioré mais il fonctionne.

Je suis étudiant en alternance et je voudrais le modifier de façon que l'ordinateur du directeur générale passe par le proxy de paris même s'il le directeur est connecté dans le sud dans l'un de nos sites.
Voici en gras les modifications que j'envisage modifier.

Ps: je propose 2 modifications, regardez ci-dessous.


Merci de votre aide.

function FindProxyForURL(url, host)

{

if (shExpMatch( host, "172.16.1.*")
|| shExpMatch(host, "172.16.2.*")
|| shExpMatch(host, "172.16.0.*")
|| shExpMatch(host, "172.16.4.*")
|| shExpMatch(host, "08t20")
|| shExpMatch(host, "eiffel")
|| shExpMatch(host, "195.220.9.*")
|| shExpMatch(host, "06t32*")
|| shExpMatch(host, "132.167.197.12")
|| shExpMatch(host, "cea.fr")
|| shExpMatch(host, "132.167.196.5")
|| shExpMatch(host, "marches.cea.fr")
|| shExpMatch(host, "a102119*")
|| shExpMatch(host, "163.5.255.26")
|| shExpMatch(host, "intra-bocal.epitech.net")
|| shExpMatch(host, "163.5.253.9")
|| shExpMatch(host, "epitech.net*")
|| shExpMatch(host, "127.0.0.1*")
|| shExpMatch(host, "193.56.40.188*")
|| shExpMatch(host, "145.242.6.153*")
|| shExpMatch(host, "81.255.245.10*")
|| shExpMatch(host, "tva.dgi.minefi.gouv.fr")
|| shExpMatch(host, "mib.nouricia.com")
|| shExpMatch(host, "secure.snecma.fr")
|| shExpMatch(host, "ineris.fr*")
|| shExpMatch(host, "cerene.info*")
|| shExpMatch(host, "82.165.200.58")
|| shExpMatch(host, "monster.fr*")
|| shExpMatch(host, "195.154.238.177")
|| shExpMatch(host, "afis.fr*")
|| shExpMatch(host, "89.30.120.84")
)

return "DIRECT";

//-----------------------------------------------------------------
//Modification n°1
// if (shExpMatch(host, "10C01.ap.ds.fr"))
// return "PROXY 172.16.0.250:8080";
//-----------------------------------------------------------------
//OU
//-----------------------------------------------------------------
//Modification n°2
// if (localHostOrDomainIs(host, "10C01.ap.ds.fr"))
// return "PROXY 172.16.0.250:8080";
//-----------------------------------------------------------------

if (isInNet(myIpAddress(), "172.16.0.0", "255.255.255.0"))

return "PROXY 172.16.0.250:8080";


if (isInNet(myIpAddress(), "172.16.1.0", "255.255.255.0"))

return "PROXY 172.16.1.250:8080";


if (isInNet(myIpAddress(), "172.16.2.0", "255.255.255.0"))

return "PROXY 172.16.2.250:8080";



return "PROXY 172.16.0.250:8080";

}
0
Rejoignez-nous