Your independent source for application and desktop virtualization.
Sign in
|
Join
Home
Topics
Blogs
Forums
Training Classes
Events
Books
About Us
Discussion Forums
»
Tech Support Forums
»
Scripting / Automation
»
vb and securecomputingCom2000-SafeWord-UserID
Marketplace
vb and securecomputingCom2000-SafeWord-UserID, in the Scripting / Automation forum on BrianMadden.com
rated by 0 users
This post has 8 Replies | 0 Followers
Points 70
Reply
Jos Embregts
Posted: 12-14-2007 2:57 AM
rated by 0 users
In vb script objMember.securecomputingCom2000-SafeWord-UserID is not working. How can I retreive token information from Active Directory?
Filed under:
Scripting
| Post Points: 20
Points 385
Reply
Brandon Shell
replied on
12-14-2007 2:12 PM
rated by 0 users
I am not sure I understand your question.
objMember could be any kind of object. If it is an AD object then securecomputingCom2000-SafeWord-UserID would have be a schema ext as that is not a standard attribute.
What is your goal?
Brandon Shell [MVP]
a.k.a BSonPosh
Note: If you want help learning Powershell or your struggling with some concepts... feel free to contact me through a post or my blog. I spend what time I have helping you learn. I do think I should be clear... I want to help you LEARN... not do your job for you. I will NOT simply write scripts for you if I do not think you wish to learn. I will spend hours if I think I can help you learn... I will not waste 5mins if I think your just want an easy way out.
| Post Points: 20
Points 70
Reply
Jos Embregts
replied on
01-03-2008 8:24 AM
rated by 0 users
Here is the script, so it explains more I hope.
--------------------------------------------------------------------
'==========================================================================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 3.0
'
' NAME: ADExport.vbs
'
' AUTHOR: Jos Embregts
' DATE : 06-12-2007
'
' COMMENT: Extract User information from Active Directory
'
'==========================================================================
Dim ObjWb
Set ObjExcel = CreateObject("Excel.Application")
iSheetsPerBook = ObjExcel.SheetsInNewWorkbook
ObjExcel.SheetsInNewWorkbook = 5
Set objBook = ObjExcel.Workbooks.Add
ObjExcel.SheetsInNewWorkbook = iSheetsPerBook
Directory = "C:\Beheer\Rapportage users_tokens\"
FileName = "_Test_Users_.xls"
DateString = year(date()) & right("0" & month(date()),2) & right("0" & day(date()),2)
Dim x, f
Set objUitDienst = GetObject("LDAP://OU=SomeName,OU=Users,OU=Company Unie,DC=ad,DC=intra")
Call ExcelUitDienst("Blad5") ' Sub to make Excel Document, depending on language (Sheet1, Blad1)
x = 1
Call enummembers(objUitDienst)
Sub enumMembers(objUitDienst)
On Error Resume Next
For Each objMember In objUitDienst ' go through the collection
If ObjMember.Class = "user" Then ' if not User object, move on.
x = x +1 ' counter used to increment the cells in Excel
' I set AD properties to variables so if needed you could do Null checks or add if/then's to this code
' this was done so the script could be modified easier.
SamAccountName = ObjMember.samAccountName
FirstName = objMember.GivenName
LastName = objMember.sn
CN = ObjMember.CN
LastLogin = objMember.LastLogin
Token = objMember.securecomputingCom2000-SafeWord-UserID
' Write the values to Excel, using the X counter to increment the rows.
objwb.Cells(x, 1).Value = FirstName
objwb.Cells(x, 2).Value = LastName
objwb.Cells(x, 3).Value = CN
objwb.Cells(x, 4).NumberFormat = "@" 'Save the value as text
objwb.Cells(x, 4).Value = SamAccountName
objwb.Cells(x, 5).Value = LastLogin
objwb.cells(x, 6).Value = Token
' Blank out Variables in case the next object doesn't have a value for the property
SamAccountName = "-"
FirstName = "-"
LastName = "-"
Cn = "-"
Name = "-"
LastLogin = "-"
Token = "-"
End If
' If the AD enumeration runs into an OU object, call the Sub again to itinerate
If objMember.Class = "organizationalUnit" or ObjMember.Class = "container" Then
enumMembers (objMember)
End If
Next
End Sub
Sub ExcelUitDienst(shtName) ' This sub creates an Excel worksheet and adds Column heads to the 1st row
Set objwb = objExcel.ActiveWorkbook.Worksheets(shtName)
Objwb.Name = "Uit_Dienst" ' name the sheet
objwb.Activate
ObjExcel.Visible = True
objwb.Cells(1, 1).Value = "First Name"
objwb.Cells(1, 2).Value = "Last Name"
objwb.Cells(1, 3).Value = "Name"
objwb.Cells(1, 4).Value = "Account Name"
objwb.Cells(1, 5).Value = "Last Login"
objwb.cells(1, 6).Value = "Token"
'formatting for header
Set objRange = objExcel.Range("A1","F1")
objRange.Interior.ColorIndex = 33
objRange.Font.Bold = True
objRange.Font.Underline = True
End Sub
'autofit the output
Set objRange = objwb.UsedRange
objRange.EntireColumn.Autofit()
Objwb.SaveAs(Directory & DateString & FileName)
ObjExcel.Quit
MsgBox "End Extraction from AD" ' show that script is complete
-------------------------------------------------------------------------
With This Script the cells "Token" stays empty.
| Post Points: 20
Points 385
Reply
Brandon Shell
replied on
01-03-2008 1:36 PM
rated by 0 users
securecomputingCom2000-SafeWord-UserID is schema extension added by SafeWord RemoteAccess.
http://www.securecomputing.com/index.cfm?skey=1281
Are you using SafeWord? I did you apply the schema extensions? Do see the value using LDP.exe or ADSIedit.msc provide by support tools?
Brandon Shell [MVP]
a.k.a BSonPosh
Note: If you want help learning Powershell or your struggling with some concepts... feel free to contact me through a post or my blog. I spend what time I have helping you learn. I do think I should be clear... I want to help you LEARN... not do your job for you. I will NOT simply write scripts for you if I do not think you wish to learn. I will spend hours if I think I can help you learn... I will not waste 5mins if I think your just want an easy way out.
| Post Points: 20
Points 70
Reply
Jos Embregts
replied on
01-10-2008 1:56 AM
rated by 0 users
Yes whe are using Safeword. Yes the schema extensions are added. In a commandbox with
csvde.exe -d "OU=Service Desk,OU=Gebruikers,OU=Arbo Unie Beheer,DC=ad,dc=intra" -r objectClass=User -l "name,sn,GivenName,sAMAccountName,securecomputingCom2000-SafeWord-UserID" -f "C:\Beheer\Rapportage users_tokens ArboUnie\servicedesk.csv"
it is working okay. I guess the problem is in vb because of the "-" signs.
| Post Points: 20
Points 20
Reply
Ojgaard
replied on
01-31-2008 4:59 AM
rated by 0 users
"I guess the problem is in vb because of the "-" signs."
Yes, Excel changes "x-z" to "x - z" causing an error :-(
Any idea how to avoid this ??
Regards
| Post Points: 20
Points 25
Reply
Heine Pedersen
replied on
02-07-2008 1:42 AM
rated by 0 users
Hey Ojgaard,
Did you ever get your script to work, since I could really use something like this :)
Regards..
| Post Points: 5
Points 70
Reply
Jos Embregts
replied on
08-20-2008 7:14 AM
rated by 0 users
Solution: objMember.[securecomputingCom2000-SafeWord-UserID] (brackets)
| Post Points: 5
Points 70
Reply
Jos Embregts
replied on
08-20-2008 7:14 AM
rated by 0 users
Solution: objMember.[securecomputingCom2000-SafeWord-UserID] (brackets)
| Post Points: 5
Previous
|
Next
Page 1 of 1 (9 items) |
RSS
Copyright © 1997-2008 The Brian Madden Company, LLC |
Disclosures
|
Privacy
|
Terms of Use
|
Contact Info