By David Wiseman (Administrator)Created 01 Mar 2008
My Rating:
Vote
Rating:
Not Rated
Views:4238
Downloads:95

Write Remote Access Permission (msNPAllowDialIn) attribute

Language:  VBScript

Compatibility

Windows XP Yes Windows 2003 Yes
Windows 2000 Unknown Windows NT Unknown
Vista Unknown Windows 2008 Unknown
Description

Modify the msNPAllowDialIn attribute. The "Remote Access Permission (Dial In or VPN)" attribute in the "Dial-In" page of the user dialog in Active Directory Users and Computers.

Code

Line Numbers: On  Off      Plain Text
Const ADS_PROPERTY_CLEAR = 1

DIM objUser
'<<<< Bind to the user object using the distinguished name >>>>
set objUser = GetObject("LDAP://cn=user1,cn=users,dc=wisesoft,dc=org,dc=uk")

' Control access through remote access policy
objUser.PutEx ADS_PROPERTY_CLEAR, "msNPAllowDialIn", null
objUser.setinfo 'Save Changes
wscript.echo "Setting changed to 'Control access through remote access policy'"

' Allow Access
objUser.Put "msNPAllowDialIn", TRUE
objUser.setinfo 'Save Changes
wscript.echo "Setting changed to 'Allow Access'"

' Deny Access
objUser.Put "msNPAllowDialIn", FALSE
objUser.setinfo 'Save Changes
wscript.echo "Setting changed to 'Deny Access'"

 


Got a useful script? Click here to upload!


 

  Post Comment
Order By:  
User Comments
      
juanpablo546
Posted On: 11/30/2011 2:46:45 PM [Edited 11/30/2011 2:47:20 PM]

Well, however as you can modify to change from a list of users in a csv file?