Active Directory modifier la valeur – appel entrant autorisé = OUI

scripting_vbs.gifOption Explicit
Dim objOU, objUser, objRootDSE
Dim strContainer, strDNSDomain, intCounter
Set objRootDSE = GetObject(« LDAP://RootDSE »)
strDNSDomain = objRootDSE.Get(« DefaultNamingContext »)
strContainer = « OU=Nom de l’OU , »
strContainer = strContainer & strDNSDomain
set objOU =GetObject(« LDAP:// » & strContainer )
intCounter = 0
For each objUser in objOU
If objUser.class= »user » then
objUser.Put « msNPAllowDialin », TRUE
objUser.SetInfo
intCounter = intCounter +1
End if
next
WScript.Echo intCounter &  » comptes modifiés. »
WScript.Quit

Activer le DHCP sur un poste client via vbs

scripting_vbs.gifRemplacer le point (« . ») par l’adresse ip de la machine a basculer en DHCP

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2")

Set colNetAdapters = objWMIService.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

For Each objNetAdapter In colNetAdapters
    'Reset IP Address and Default Gateway to DHCP
    errEnable = objNetAdapter.EnableDHCP()
    'Reset DNS Server list to DHCP
    arrDNSServers = Array()
    objNetAdapter.SetDNSServerSearchOrder(arrDNSServers)
    'Reset DNS Server Domain to DHCP
    strDNSDomain = ""
    objNetAdapter.SetDNSDomain strDNSDomain
    'Reset WINS Server list to DHCP
    strPrimaryServer = ""
    strSecondaryServer = ""
    objNetAdapter.SetWINSServer strPrimaryServer, strSecondaryServer
    'Reset DNS Server Suffix list
    Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootcimv2")
    Set objNetworkSettings = objWMIService.Get("Win32_NetworkAdapterConfiguration")
    arrDNSSuffixes = Array("", "")
    objNetworkSettings.SetDNSSuffixSearchOrder(arrDNSSuffixes)
Next