About to give up on working with NT users in ASP

Results 1 to 5 of 5

Thread: About to give up on working with NT users in ASP

  1. #1
    Ben Roy Guest

    Default About to give up on working with NT users in ASP

    Well I found some great information on how to edit the registry from ASP pages without having to buy any components, but then realized that NT user information is not stored anywhere in the registry. I have been unable to find any references anywhere on how one can programatically modify dialup permissions on user accounts in NT. There are lots of different ways to create accounts, change passwords, define when users are allowed to log on, etc., but none of them exposes the "grant dialin permission" property. If anyone knows something about this or could point me towards a forum where I might find more information I would really appreciate it.

  2. #2
    Ian Stallings Guest

    Default RE: About to give up on working with NT users in A

    Ahh young Ben, so quick to give up..<BR>Just kidding :)<BR><BR>You can access the ACL using ADSI<BR>(Active Directory Service Interface)<BR><BR>There is allot of info at:<BR>http://msdn.microsoft.com (search for adsi)<BR>http://www.15seconds.com<BR><BR>There is also a using ADSI in ASP from wrox:<BR><BR>http://www.wrox.com/Consumer/Store/Details.asp?ISBN=186100169X<BR><BR>you can find some good adsi scripts at:<BR>http://cwashington.netreach.net<BR><BR>hope this helps :)<BR>

  3. #3
    Michael Swanson Guest

    Default RE: About to give up on working with NT users in A

    I would second the vote for the Wrox "ADSI ASP" book...it&#039s a good one.<BR><BR>Michael Swanson, MCSE, MCP+Internet<BR>Webmaster<BR>Donnelly Corporation<BR>mike.swanson@donnelly.com

  4. #4
    Ben Roy Guest

    Default RE: About to give up on working with NT users in A

    I tell ya, you old guys always miss something don&#039t ya? ;-) Anyway, the problem is not that I don&#039t know HOW to do it with ADSi. I can get in there and create a user, set their password, define when they are allowed on line, etc. The problem is that there is no property exposed in ADSI for dialup permission. It just isn&#039t implemented. You cannot modify that particular property via ADSI. I know it can be done somehow because I got someone to send me a command line exe that does it, but he didn&#039t send me source or anything and I have no idea who he is so I&#039m a little loathe to use it. Anyway, that&#039s the clarification. Thanks for the posts though.


  5. #5
    Join Date
    Dec 1969
    Posts
    760

    Default ASP is the magic glue, not the magic itself

    There is a wonderfull component called the windows scripting host, it probably exists on your system.<BR>Go to MSDN and look for examples of what can be done with WSH.<BR><BR>Here is file name "ADDUSERS.VBS" from those examples<BR><BR>&#039 Windows Script Host Sample Script<BR>&#039<BR>&#039 ------------------------------------------------------------------------<BR>&#039 Copyright (C) 1996 Microsoft Corporation<BR>&#039<BR>&#039 You have a royalty-free right to use, modify, reproduce and distribute<BR>&#039 the Sample Application Files (and/or any modified version) in any way<BR>&#039 you find useful, provided that you agree that Microsoft has no warranty,<BR>&#039 obligations or liability for any Sample Application Files.<BR>&#039 ------------------------------------------------------------------------<BR>&#039<BR>&#039This script is adds users from the Windows NT DS<BR>&#039via ADSI. The script reads an EXCEL spreadsheet that contains a page <BR>&#039of users to add. <BR>&#039<BR>&#039The sample uses the directory root "LDAP://DC=ArcadiaBay,DC=Com,O=Internet"<BR>&#039Change the directory path in the EXCEL spreadsheet to match your DS<BR>&#039before running this sample.<BR>&#039<BR>&#039<BR>&#039<BR>&#039To add users, run ADDUSERS.VBS with %windir%\"Your Samples Directory Here"AddUsers.XLS.<BR>&#039To Delete users, run DELUSERS.VBS with %windir%\"Your Samples Directory Here"DelUsers.XLS.<BR><BR><BR> Dim oXL<BR> Dim u<BR> Dim c<BR> Dim root<BR> Dim ou<BR> Dim TextXL<BR> Dim CRLF<BR> dim oArgs<BR><BR> <BR> &#039Get the command line args<BR> set oArgs=wscript.arguments<BR><BR> CRLF = Chr(13) & Chr(10)<BR> <BR> &#039If no command line arguments provided, prompt for file containing users to add/delete<BR> If oArgs.Count = 0 Then<BR> TextXL = InputBox("This scripts reads an Excel spreadsheet and adds" & _<BR> "users from the Windows NT DS via ADSI." & CRLF & CRLF & _<BR> "Before starting, change the DS root in the EXCEL spreadsheet to match " & _<BR> "your DS." & CRLF & CRLF & _<BR> "Type in the path of a file containing users to add or delete" & CRLF & CRLF & _<BR> "Sample Add User file: ADDUSERS.XLS" & CRLF & _<BR> "Sample Delete User file: DELUSERS.XLS" & CRLF)<BR> &#039Else file containing users is the first argument<BR> Else<BR> TextXL = oArgs.item(0)<BR> End If<BR><BR> If TextXL = "" Then<BR> WScript.Echo "No input file provided. Stopping the script now."<BR> WScript.Quit(1)<BR> End If<BR><BR> &#039We will use ou to control loop, so set initial value to null<BR> ou = ""<BR> <BR> &#039Start EXCEL and display it to the user<BR> Set oXL = WScript.CreateObject("EXCEL.application")<BR> oXL.Visible = True<BR><BR> &#039Open the workbook passed in the command line<BR> oXL.workbooks.open TextXL<BR><BR> &#039Activate the Add page <BR> oXL.sheets("Add").Activate<BR><BR> &#039Put the cursor in the starting cell and read the DS root<BR> oXL.ActiveSheet.range("A2").Activate &#039 this cell has the DS root in it<BR><BR> &#039Show it to the user<BR> &#039WScript.Echo oXL.activecell.Value<BR> <BR> &#039This is the starting point in the ds<BR> root = oXL.activecell.Value<BR><BR> &#039Step to the next row<BR> oXL.activecell.offset(1, 0).Activate<BR><BR> &#039Until we run out of rows<BR> Do While oXL.activecell.Value &#060;&#062; ""<BR> <BR> &#039if the requested OU is a new one...<BR> If oXL.activecell.Value &#060;&#062; ou Then<BR> &#039Pick up the OU name...<BR> ou = oXL.activecell.Value<BR><BR> &#039Compose the ADSI path...<BR> s = "LDAP://" + ou+"," + root<BR><BR> &#039Show it to the user...<BR> WScript.Echo s<BR><BR> &#039And get the object<BR> Set c = GetObject(s)<BR> End If<BR><BR> &#039Compose the user common name name from first and last names...<BR> uname = "CN=" + oXL.activecell.offset(0, 1).Value + " " + oXL.activecell.offset(0, 2).Value<BR><BR> &#039Create the new user object...<BR> Set u = c.Create("user", uname)<BR><BR> &#039Set the properties of the new user<BR> u.Put "givenName", oXL.activecell.offset(0, 1).Value &#039givenName<BR> u.Put "sn", oXL.activecell.offset(0, 2).Value &#039sn<BR> u.Put "mail", oXL.activecell.offset(0, 3).Value &#039Email<BR> u.Put "sAMAccountName", oXL.activecell.offset(0, 4).Value &#039Sam Acct<BR> u.Put "telephoneNumber", oXL.activecell.offset(0, 5).Value &#039Phone<BR><BR> &#039Enable the account, must change pw @ logon<BR> u.Put "userAccountControl",16 <BR><BR> &#039...and update the DS<BR> u.SetInfo<BR><BR> &#039Done with this object, discard it<BR> Set u = Nothing<BR><BR> &#039Step to the next user...<BR> oXL.activecell.offset(1, 0).Activate &#039Next row<BR> Loop<BR><BR><BR> &#039Done. close excel spreadsheet<BR> oXL.application.quit<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •