[VBScript] partage de connection suivant hora
Ze Big Duck
-
mmisterk -
mmisterk -
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 (sur win XP) :
J'aurais voulu savoir s'il était possible de mettre une connection en route à 21h, et de la couper à 6h du matin, et comment (en éxécutant le script sur son pc bien sûr) ?
Merci
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 (sur win XP) :
'
'Title: toggleICS.vbs
'Purpose: turn on and turn off the Internet Connection Sharing on a specified interface
'Platform: Windows XP
'Requirement: Wscript.exe
'
'Date: 20/05/05
'
DIM CONNECTION_ALL
DIM NetSharingManager
DIM EveryConnectionCollection
DIM EveryConnection
DIM Arguments
DIM Interface
CONNECTION_ALL = 2
Interface = "Freebox"
set WshShell = WScript.CreateObject("WScript.Shell")
if initialize() then
if GetConnectionObjects() then
if FirewallTestByName(Interface) then
ChangeSharing()
end if
end if
end if
function FirewallTestByName(InterfaceName)
on error resume next
DIM Item
DIM Properties
DIM InterfaceExist
InterfaceExist = FALSE
for each Item in EveryConnectionCollection
set EveryConnection = NetSharingManager.INetSharingConfigurationForINetConnection(Item)
set Properties = NetSharingManager.NetConnectionProps(Item)
if (ucase(InterfaceName) = ucase(Properties.Name)) then
InterfaceExist = TRUE
exit for
end if
next
FirewallTestByName = InterfaceExist
end function
function ChangeSharing()
if EveryConnection.SharingEnabled then
EveryConnection.DisableSharing
else
EveryConnection.EnableSharing(ICSSHARINGTYPE_PUBLIC)
end if
end function
function Initialize()
'output: TRUE or FALSE
DIM Return
Return = FALSE
set NetSharingManager = Wscript.CreateObject("HNetCfg.HNetShare.1")
if (IsObject(NetSharingManager)) = FALSE then
Wscript.Echo("The Internet Sharing Manager cannot be contacted. Internet Connection Firewall may not be available on this interface.")
else
if (IsNull(NetSharingManager.SharingInstalled) = TRUE) then
Wscript.Echo("Internet Connection Firewall may not be available on this interface.")
else
Return = TRUE
end if
end if
Initialize = Return
end function
function GetConnectionObjects()
DIM Return
DIM Item
Return = TRUE
if GetConnection(CONNECTION_ALL) = FALSE then
Return = FALSE
end if
GetConnectionObjects = Return
end function
function GetConnection(CONNECTION_TYPE)
DIM Return
DIM Connection
DIM Item
Return = TRUE
if (CONNECTION_ALL = CONNECTION_TYPE) then
set Connection = NetSharingManager.EnumEveryConnection
if (Connection.Count > 0) then
set EveryConnectionCollection = Connection
else
Return = FALSE
end if
else
Return = FALSE
end if
GetConnection = Return
end function
J'aurais voulu savoir s'il était possible de mettre une connection en route à 21h, et de la couper à 6h du matin, et comment (en éxécutant le script sur son pc bien sûr) ?
Merci
A voir également:
- [VBScript] partage de connection suivant hora
- Partage de photos - Guide
- Meilleur site partage abonnement - Accueil - Services en ligne
- Gmail connection - Guide
- Partage reseau - Guide
- Partage d'écran whatsapp pc - Accueil - Messagerie instantanée