ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 18th, 2012, 09:24 AM
Samuel J Link Samuel J Link is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 10 Samuel J Link User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 29 m 31 sec
Reputation Power: 0
Permissions

Hello everyone, i've been doing quite a bit of reading over the past week and cannot seem to find a remedy for my script. What i'm looking to do is add a user to an active directory group leveraging an existing classic asp page. I currently have an ID and pw with the proper credentials and am looking for an alternative to giving all who access the page admin rights.

My script fails giving me the error `80072020` on the line:

Set objGroup = GetObject("LDAP://CN=MOI-USERS-GS,OU=Applications,OU=Groups,DC=corporate,DC=corp,DC=com")

Is it possible for me to establish credentials for this operation that would allow it to be carried out and how?

here are the relevant pieces of the script in question:

asp Code:
Original - asp Code
  1.  
  2.  
  3. <%
  4.  
  5. Dim result, personFor, personBy
  6.    
  7.     personFor = "Samuel J Link"
  8.     personBy = "Samuel J Link"
  9.     result = getDN(personFor)
  10.  
  11. 'Main
  12.         If isMember("MOI-USERS-GS")=1 Then 
  13.                 response.write("Is member") 
  14.                            
  15.         Else
  16.                 response.write("Is not a member")
  17.                
  18.                 Set objGroup = GetObject("LDAP://CN=MOI-USERS-GS,OU=Applications,OU=Groups,DC=corporate,DC=corp,DC=com")
  19.                 Set objUser = GetObject("LDAP://" & result)
  20.                 objGroup.add(objUser.ADspath)               
  21.         End If
  22.        
  23. 'Is member
  24.         Function IsMember(groupName)
  25.             If IsEmpty(groupListD) then
  26.                 Set groupListD = CreateObject("Scripting.Dictionary")
  27.                 groupListD.CompareMode = 1
  28.                
  29.                 dim result
  30.                 result = "Uid"
  31.                                
  32.                 ADpath = "Corporate" & "/" & result
  33.                 Set userPath = GetObject("WinNT://" & ADpath & ",user")
  34.                 For Each listGroup in userPath.Groups
  35.                     groupListD.Add listGroup.Name, "-"
  36.                 Next
  37.             End if
  38.             IsMember = CBool(groupListD.Exists(groupName))
  39.         End Function
  40.        
  41. 'get personFor DN   
  42.         Function getDN(name)
  43.        
  44.             Dim adoCommand, adoConnection, strBase, strFilter, strAttributes
  45.             Dim objRootDSE, strDNSDomain, strQuery, adoRecordset, strsAM, objUser
  46.            
  47.  
  48.             Set adoConnection = CreateObject("ADODB.Connection")               
  49.                 adoConnection.Provider = "ADsDSOObject"
  50.                     With adoConnection
  51.                         .Properties("User ID") = "PID"  'This is where the Process ID goes
  52.                         .Properties("Password") = "PW"             'password
  53.                         .Properties("encrypt password") = True
  54.                     End With
  55.  
  56.             adoConnection.Open "Active Directory Provider"
  57.             Set adoCommand = CreateObject("ADODB.Command")
  58.             Set adoCommand.ActiveConnection = adoConnection
  59.            
  60.        
  61.             Set objRootDSE = GetObject("LDAP://RootDSE")
  62.             strDNSDomain = objRootDSE.Get("defaultNamingContext")   
  63.            
  64.             adoCommand.CommandText = "<LDAP://corporate.amfam.com>;(&(objectCategory=user)(CN=" & name & "));distinguishedName;subtree"
  65.             adoCommand.Properties("Page Size") = 100
  66.             adoCommand.Properties("Timeout") = 30
  67.             adoCommand.Properties("Cache Results") = False
  68.            
  69.             Set adoRecordset = adoCommand.Execute
  70.  
  71.             strsAM = adoRecordset.Fields("distinguishedName").Value
  72.             getDN= strsAM   
  73.                
  74.             adoRecordset.Close
  75.             adoConnection.Close
  76.         End Function       
  77.  
  78. %>
  79.  


thank you everyone for your assistance and time.

Reply With Quote
  #2  
Old June 18th, 2012, 03:22 PM
Samuel J Link Samuel J Link is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 10 Samuel J Link User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 29 m 31 sec
Reputation Power: 0
got it

Hey everyone, got the above code to work by using the:
asp Code:
Original - asp Code
  1. Dim oGroup: Set oGroup = oDSObj.OpenDSObject


now i'm attempting to append information to a csv but cant seem to get the file path specified correctly. does there appear to be anything wrong with this path? or is it just another permissions issue?? x_x

asp Code:
Original - asp Code
  1. 'output To CSV Log
  2.     sub outputToCSV (arg0, arg1, arg2)
  3.    
  4.         Const ForAppending = 8
  5.        
  6. 'change log to final destination
  7.         strFileOutput = "http://seconsec/seconsec/dev/sam/logs.csv"
  8.    
  9.         Set objFSO = server.CreateObject("Scripting.FileSystemObject")
  10.    
  11.         If objFSO.FileExists(strFileOutput) Then
  12.           Set objOutputFile = objFSO.OpenTextFile (strFileOutput, 8)
  13.         Else
  14.           Set objOutputFile = objFSO.CreateTextFile(strFileOutput)
  15.           objOutputFile.Writeline "Date:" & "," & "Requested for:" & "," & "Requested By:" & "," & "Status of Request:"
  16.         End If
  17.         If Err <> 0 Then
  18.           Wscript.Echo "Unable to open " & strFileOutput & " for output."
  19.           WScript.Quit
  20.         End If
  21.    
  22.         objOutputFile.Writeline Date()  & "," & arg0 & "," & arg1 & "," & arg2
  23.        
  24.     End sub

Reply With Quote
  #3  
Old June 18th, 2012, 05:28 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,239 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 15 h 20 m 7 sec
Reputation Power: 4445
Thank you for updating the topic with your solution.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Permissions

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap