Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: Set msNPAllowDialin to Not Set

HTVi
TV Discussion Newsgroups

Set msNPAllowDialin to Not Set
Gary <gary[ at ]menkaura.com> 4/17/2007 3:07:09 PM
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

Re: Set msNPAllowDialin to Not Set
"Richard Mueller [MVP]" <rlmueller-nospam[ at ]ameritech.nospam.net> 4/17/2007 4:35:54 PM
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
--

"Gary" <gary[ at ]menkaura.com> wrote in message
news:1176822429.734817.262440[ at ]y5g2000hsa.googlegroups.com...
[Quoted Text]
> 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
>


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen