Usuário com melhor resposta
Alterar configurações da aba Dial-in

Pergunta
-
Respostas
-
Fala Serrão!
Este cara estava com quase a mesma necessidade que você....
Aê vc sevira a altera ele para as suas necessidades.
Como estão as coias aê na empresa?
abraço mermão, o Judson vai marcar uma ida ao coronel picanha! vê se aparece!
I need a script that will do two things.
1. Scan Active Directory for disable user accounts
2. Then change the msNPAllowDialin attribute on those account to Deny
Access
http://groups.google.com/group/microsoft.public.scripting.vbscript/browse_thread/thread/3dff6e5e5ac98ccb?pli=1
Option Explicit
Dim adoCommand, adoConnection, strBase, strFilter, strAttributes
Dim objRootDSE, strDNSDomain, strQuery, adoRecordset, strDN, objUser
' Setup ADO objects.
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection' Search entire Active Directory domain.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://" & strDNSDomain & ">"' Filter on disabled users that can dial in.
strFilter = "(&(objectCategory=person)(objectClass=user)" _& "(userAccountControl:1.2.840.113556.1.4.803:=2)" _
& "(msNPAllowDialin=TRUE))"
' Comma delimited list of attribute values to retrieve.
strAttributes = "distinguishedName"' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False' Run the query.
Set adoRecordset = adoCommand.Execute' Enumerate the resulting recordset.
Do Until adoRecordset.EOF' Retrieve values and display.
strDN = adoRecordset.Fields("distinguishedName").Value' Bind to the user object.
Set objUser = GetObject("LDAP://" & strDN)
' Deny dialin.
objUser.msNPAllowDialin = False
' Save changes.
objUser.SetInfo
Wscript.Echo "User " & strDN & " denied permission to dial in"
' Move to the next record in the recordset.
adoRecordset.MoveNext
Loop' Clean up.
adoRecordset.Close
adoConnection.Close- Marcado como Resposta Fábio JrModerator sexta-feira, 20 de janeiro de 2012 12:55
Todas as Respostas
-
Fala Serrão!
Este cara estava com quase a mesma necessidade que você....
Aê vc sevira a altera ele para as suas necessidades.
Como estão as coias aê na empresa?
abraço mermão, o Judson vai marcar uma ida ao coronel picanha! vê se aparece!
I need a script that will do two things.
1. Scan Active Directory for disable user accounts
2. Then change the msNPAllowDialin attribute on those account to Deny
Access
http://groups.google.com/group/microsoft.public.scripting.vbscript/browse_thread/thread/3dff6e5e5ac98ccb?pli=1
Option Explicit
Dim adoCommand, adoConnection, strBase, strFilter, strAttributes
Dim objRootDSE, strDNSDomain, strQuery, adoRecordset, strDN, objUser
' Setup ADO objects.
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection' Search entire Active Directory domain.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://" & strDNSDomain & ">"' Filter on disabled users that can dial in.
strFilter = "(&(objectCategory=person)(objectClass=user)" _& "(userAccountControl:1.2.840.113556.1.4.803:=2)" _
& "(msNPAllowDialin=TRUE))"
' Comma delimited list of attribute values to retrieve.
strAttributes = "distinguishedName"' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False' Run the query.
Set adoRecordset = adoCommand.Execute' Enumerate the resulting recordset.
Do Until adoRecordset.EOF' Retrieve values and display.
strDN = adoRecordset.Fields("distinguishedName").Value' Bind to the user object.
Set objUser = GetObject("LDAP://" & strDN)
' Deny dialin.
objUser.msNPAllowDialin = False
' Save changes.
objUser.SetInfo
Wscript.Echo "User " & strDN & " denied permission to dial in"
' Move to the next record in the recordset.
adoRecordset.MoveNext
Loop' Clean up.
adoRecordset.Close
adoConnection.Close- Marcado como Resposta Fábio JrModerator sexta-feira, 20 de janeiro de 2012 12:55
-
-