Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Modifying User Dial-In Properties

Status
Not open for further replies.

L8knight

Technical User
Apr 16, 2004
3
US
I have been struggling over this all day and I'm about to throw my computer out the window. I am trying to create a script to modify the User Dial-In properties, which has to be done with LDAP. I can modify it to "True" (allow)or "False" (deny) without a problem... but of course the one I need to set it to "EMPTY" (aka: Control Access Through Remote Access Policy) does not work. Every Microsoft TechNet, MSDN and example I have found says to do it this way:

UsrObj.Put "msNPAllowDialin", EMPTY

When I do that I get:
Error: Unspecified Error
Code: 80004005
Source: (null)

I've tried everything, and nothing seems to work. Has anyone done this successfully?

My Code:
========
Set UsrObj = GetObject("LDAP://CN=Schmoe Joe, OU=Users,DC=Microshaft,DC=COM")

'echo current setting
wscript.echo UsrObj.msNPAllowDialin & vbcrlf

' Set RAS Option
UsrObj.Put "msNPAllowDialin", EMPTY
'Apply RAS Option
UsrObj.SetInfo

'echo to check changes
wscript.echo UsrObj.msNPAllowDialin & vbcrlf
 
Hello L8knight,

This is the way ms proposed with their technet adapted to your domain.
Code:
Const ADS_PROPERTY_CLEAR = 1
objUser.PutEx ADS_PROPERTY_CLEAR, "msNPAllowDialin", 0
'etc etc
'objUser.SetInfo
regards - tsuji
 
Thanks! Worked like a champ. Plugged it into my script and I'm now ready to run it against the list of users. You saved a laptop from meeting certain death after flying out my window :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top