Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2327 connectés 

  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  script pour connexion

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

script pour connexion

n°1109626
Ze Big Duc​k
Posté le 06-06-2005 à 13:51:13  profilanswer
 

Bonjour,
 
L'hôte de mon domaine coupe le partage de la connection internet à 20h30, il la re-partage à 9h.
 
voici son script, qu'il éxécute en tant que tâche planifiée :

Code :
  1. '
  2. 'Title: toggleICS.vbs
  3. 'Purpose: turn on and turn off the Internet Connection Sharing on a specified interface
  4. 'Platform: Windows XP
  5. 'Requirement: Wscript.exe
  6. '
  7. 'Date: 20/05/05
  8. '
  9. DIM CONNECTION_ALL
  10. DIM NetSharingManager
  11. DIM EveryConnectionCollection
  12. DIM EveryConnection
  13. DIM Arguments
  14. DIM Interface
  15. CONNECTION_ALL = 2
  16. Interface = "Freebox"
  17. set WshShell = WScript.CreateObject("WScript.Shell" )
  18. if initialize() then
  19. if GetConnectionObjects() then
  20.  if FirewallTestByName(Interface) then
  21.   ChangeSharing()
  22.  end if
  23. end if
  24. end if
  25. function FirewallTestByName(InterfaceName)
  26. on error resume next
  27.     DIM Item
  28.     DIM Properties
  29.     DIM InterfaceExist
  30.     InterfaceExist = FALSE
  31.     for each Item in EveryConnectionCollection
  32.         set EveryConnection = NetSharingManager.INetSharingConfigurationForINetConnection(Item)
  33.         set Properties = NetSharingManager.NetConnectionProps(Item)
  34.          
  35.         if (ucase(InterfaceName) = ucase(Properties.Name)) then
  36.   InterfaceExist = TRUE
  37.   exit for     
  38.         end if
  39.     next
  40.     FirewallTestByName = InterfaceExist
  41. end function
  42. function ChangeSharing()
  43. if EveryConnection.SharingEnabled then
  44.  EveryConnection.DisableSharing
  45. else
  46.  EveryConnection.EnableSharing(ICSSHARINGTYPE_PUBLIC)
  47. end if
  48. end function
  49. function Initialize()
  50. 'output: TRUE or FALSE
  51.     DIM Return
  52.     Return = FALSE
  53.     set NetSharingManager = Wscript.CreateObject("HNetCfg.HNetShare.1" )
  54.     if (IsObject(NetSharingManager)) = FALSE then
  55.         Wscript.Echo("The Internet Sharing Manager cannot be contacted.  Internet Connection Firewall may not be available on this interface." )
  56.     else
  57.         if (IsNull(NetSharingManager.SharingInstalled) = TRUE) then
  58.             Wscript.Echo("Internet Connection Firewall may not be available on this interface." )
  59.         else
  60.             Return = TRUE
  61.         end if
  62.     end if
  63.     Initialize = Return
  64. end function
  65. function GetConnectionObjects()
  66.     DIM Return
  67.     DIM Item
  68.  
  69.     Return = TRUE
  70.  
  71.     if GetConnection(CONNECTION_ALL) = FALSE then
  72.         Return = FALSE
  73.     end if
  74.  
  75.     GetConnectionObjects = Return   
  76. end function
  77. function GetConnection(CONNECTION_TYPE)
  78.     DIM Return   
  79.     DIM Connection
  80.     DIM Item
  81.     Return = TRUE
  82.  
  83.     if (CONNECTION_ALL = CONNECTION_TYPE) then
  84.         set Connection = NetSharingManager.EnumEveryConnection
  85.      
  86.         if (Connection.Count > 0) then
  87.             set EveryConnectionCollection = Connection
  88.         else
  89.             Return = FALSE
  90.         end if
  91.      
  92.     else
  93.         Return = FALSE
  94.     end if
  95.  
  96.     GetConnection = Return
  97. end function


 
J'aurais voulu savoir s'il était possible de mettre une connection en route à 21h, et de la couper à 6h du matin ?
 
Merci


Message édité par Ze Big Duck le 06-06-2005 à 14:08:11
mood
Publicité
Posté le 06-06-2005 à 13:51:13  profilanswer
 

n°1109627
Ze Big Duc​k
Posté le 06-06-2005 à 13:52:26  profilanswer
 

test ?

n°1109669
antp
Super Administrateur
Champion des excuses bidons
Posté le 06-06-2005 à 14:08:37  profilanswer
 

j'ai changé le titre, mais il serait plus prudent que tu changes de mot de passe quand même, parce que là kadreg a joué avec... :p


Message édité par antp le 06-06-2005 à 14:08:56

---------------
mes programmes ·· les voitures dans les films ·· apprenez à écrire
n°1109715
Harkonnen
Modérateur
Un modo pour les bannir tous
Posté le 06-06-2005 à 14:27:01  profilanswer
 


évidemment, y'en a qu'un qui fait la connerie... [:rofl2]


---------------
J'ai un string dans l'array (Paris Hilton)
n°1110010
Ze Big Duc​k
Posté le 06-06-2005 à 16:45:45  profilanswer
 

merci à tous :)

n°1110704
Ze Big Duc​k
Posté le 07-06-2005 à 11:06:37  profilanswer
 

En fait je vasi pas m'embêter, je vais simplement mettre un wait 21000.... et remettre le même script après le wait, comme ça ça fonctionnera, c'est un peu barbare comme méthode, mais j'ai aucune connaissance en vbs moua :'( lol


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  script pour connexion

 

Sujets relatifs
Script DOS pour modifier l'ipprobleme avec un script d'upload
Des conseils pour un scriptscript d'ouverture de session en WSH
cherche script qui met date spécifiqueproblème script connexion easyphp 1.8
problème script connexion easyphp 1.8Script de connexion telnet smtp
Script de connexionRecherche de Script de connexion NT
Plus de sujets relatifs à : script pour connexion


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR