Home All Groups Group Topic Archive Search About

Set msNPAllowDialin to Not Set



Author
17 Apr 2007 3:07 PM
Gary
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

Author
17 Apr 2007 4:35 PM
Richard Mueller [MVP]
Answered in microsoft.public.scripting.vbscript.

Define constant and add required third parameter to PutEx method.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--

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
>

AddThis Social Bookmark Button