Advertisement
lincruste

Paramétrage à distance du proxy sous Windows

Jan 13th, 2014
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.11 KB | None | 0 0
  1. @echo off
  2. echo Batch pour forcer le parametrage du proxy - MB. Technology Inc 2013 -
  3.  
  4. rem requête de l'IP
  5.  
  6. @SET /P adresse=[Entrez l'adresse IP du poste]
  7. pushd "\\chemin\UNC\vers\Sysinternals\"
  8.  
  9. rem extraction du SID de l'utilisateur connecté au poste distant
  10. rem premiere étape, trouver le samaccountname (%samAN%) à partir de l'IP via wmic
  11.  
  12. for /f %%a in ('wmic /Node:%adresse% ComputerSystem Get UserName^|find /i "mdl"') do (set samAN=%%a)
  13. rem seconde étape, récuperer l'USID avec psgetsid.exe (%USID%)
  14. for /f %%b in ('Psgetsid.exe /accepteula \\%adresse% %samAN%^|find /i "S-1"') do (set USID=%%b)
  15.  
  16. rem modification de la base de registre distante
  17. rem démarrage du service "Registre à distance", passage en auto
  18.  
  19. sc \\%adresse% start RemoteRegistry&&sc \\%adresse% config RemoteRegistry start= auto
  20.  
  21. reg add "\\%adresse%\HKU\%USID%\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d http:adresse.du.proxy:port /f
  22. reg add "\\%adresse%\HKU\%USID%\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 00000001 /f
  23. popd
  24. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement