Tip

Dump name from ID file

Like many shops, we have a network directory with thousands of Notes ID files. Which variation of JSMITH.ID belongs to Jane Smith, who lost her id file or forgot her password. We are now naming by network account, but have many using default conventions. This agent reads through a directory of ID files and writes a file displaying the file name and the most current Notes canonical name (accounts for name changes in an id file).


' Name: dump Notes ID file
' Purpose: prints name of id file and most current name stored in ID.
'   prints NO NAME FOUND if no canonical name is found in the ID
' 09/26/01 - created. EAJ

Option Public
Option Declare

Sub Initialize
Dim f As Integer, g As Integer, i As Integer, j As Integer
Dim IDpath As String, IDfile As String, InLine As String, OutName As String
On Error Goto processError	' read past end of file
g% = Freefile
Open "c:\idout.txt" For Output As #g%
IDpath = "h:\Notes\R5\data\ids\people\"
IDfile = Dir$(IDpath+"*.id")
	
Do While IDfile <> ""
	f% = Freefile
	Open IDpath+IDfile For Input As #f%
	InLine = ""
	OutName = "NO NAME FOUND"
	Do Until Eof (f%)
		InLine = InLine + Input$ (256, #f%)
		i = Instr (InLine, "CN=")
		If i > 1 Then
			InLine = Mid$ (InLine, i) + Input$ (32, #f%)
			j = Instr (InLine, "O=CHP")
			If j > 0 Then
				OutName = Left$ (InLine, j+5)
				Inline = Mid$ (InLine, j+6)
			Else
				InLine = Mid$ (Inline, 3)
			End If
		Else
			InLine = Right$ (InLine, 2)
		End If
	Loop
NextFile:
	IDfile = Dir$()
Loop
Close g%
Exit Sub
processError:
Close f%
Print #g%,IDfile,OutName
Resume nextfile
End Sub

This was first published in November 2001

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.