Wednesday, August 27, 2008

Allow dial in access by script

I will show you how to enable the Remote Access Service "Allow Access" permission in the Remote Access Permission of the Dial-In tab in the user's properties.
There are 2 cases:
1) For Windows 2000-based domains in Mixed mode or Windows 2000-based domains in Native mode that include RAS servers hosted by Microsoft Windows NT-based computers, see here http://support.microsoft.com/default.aspx?scid=kb;en-us;252398
2) For Windows 2000 domains in native mode and Windows 2003 Server mode, this is the script that will enable Dial-in access for all the users in Test OU:

OUPath ="LDAP://OU=Test,DC=test,DC=com"
Set CNUsers = GetObject (OUPath)
CNUsers.Filter = Array("user")
For Each User in CNUsers
Set objUser = GetObject("LDAP://" & User.DistinguishedName)
objUser.Put "msNPAllowDialIn", True
objUser.SetInfo
Next