|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Set msNPAllowDialin to Not Set
Almost there ... however I need to set the Dial-in properties to "Control Access through Remote Access Policy" which I understand is done by setting "msNPAllowDialin" to "Not Set". The code seems to work for both TRUE and FALSE values which Allow Access and Deny Access but I can seem to affect the "Control Access through Remote Access Policy" control. Can anyone assist. Many thanks ... Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOObject" objConnection.Open "Active Directory Provider" Set objCommand.ActiveConnection = objConnection objCommand.CommandText = "Select DistinguishedName from 'LDAP:// dc=Server,dc=com' where objectClass='user' AND sAMAccountName=" & "'" & sUser & "'" objCommand.Properties("Page Size") = 100 objCommand.Properties("Timeout") = 30 objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE objCommand.Properties("Cache Results") = False Set objRS = objCommand.Execute objRS.MoveFirst sOU = objRS("distinguishedName") Set objUser = GetObject("LDAP://" & sOU) objUser.PutEx ADS_PROPERTY_CLEAR, "msNPAllowDialin" objUser.SetInfo Answered in microsoft.public.scripting.vbscript.
Define constant and add required third parameter to PutEx method. Show quote "Gary" <g***@menkaura.com> wrote in message news:1176822429.734817.262440@y5g2000hsa.googlegroups.com... > Hi All > > Almost there ... however I need to set the Dial-in properties to > "Control Access through Remote Access Policy" which I understand is > done by setting "msNPAllowDialin" to "Not Set". The code seems to work > for both TRUE and FALSE values which Allow Access and Deny Access but > I can seem to affect the "Control Access through Remote Access Policy" > control. Can anyone assist. > > Many thanks ... > > > Set objConnection = CreateObject("ADODB.Connection") > Set objCommand = CreateObject("ADODB.Command") > objConnection.Provider = "ADsDSOObject" > objConnection.Open "Active Directory Provider" > Set objCommand.ActiveConnection = objConnection > objCommand.CommandText = "Select DistinguishedName from 'LDAP:// > dc=Server,dc=com' where objectClass='user' AND sAMAccountName=" & "'" > & sUser & "'" > objCommand.Properties("Page Size") = 100 > objCommand.Properties("Timeout") = 30 > objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE > objCommand.Properties("Cache Results") = False > Set objRS = objCommand.Execute > objRS.MoveFirst > > sOU = objRS("distinguishedName") > > Set objUser = GetObject("LDAP://" & sOU) > objUser.PutEx ADS_PROPERTY_CLEAR, "msNPAllowDialin" > objUser.SetInfo > |
|||||||||||||||||||||||