Solved

create a list of users and contexts

Posted on 1998-10-14
7
327 Views
Last Modified: 2008-02-20
Hi,
  I would like to be able to create a text file which lists all of the userids and contexts in a Directory.  I tried doing this with cx, but it doesn't seem to list the user objects.  Any idea?  If there are any inexpensive third party utilities that can do this, I am interested.
  Many Thanks,
Jeremy
0
Comment
Question by:jshafer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 

Author Comment

by:jshafer
ID: 1593726
(Oh yes, I am using NW 4.1)
0
 

Expert Comment

by:jtest
ID: 1593727
I have code that allows me to list all users, with contexts, on a given Intranetware 4 server.  Is this what you are looking for? It uses the NW* calls in CLXWin32.Dll.

Can't get it until tomorrow, but let me know if this is useful.


0
 

Author Comment

by:jshafer
ID: 1593728
Yes, that would be very helpful.  I presume these are VB routines?
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 3

Accepted Solution

by:
brosenb0 earned 100 total points
ID: 1593729
You can create a text file that lists every user, in all contexts from the [root] down by using the Novell supplied utility NList.Exe, found in Sys:Public.

Type the following: NList user /R /S >MyFile.Txt

Type NList /? for help
0
 

Expert Comment

by:jtest
ID: 1593730
Sorry, I've been away unexpectedly.  If brosenb0 ans. isn't enough, I'll try to upload some VB code next week.
0
 

Expert Comment

by:jtest
ID: 1593731
'Here's code that works for me...it lists all the servers in the
'debug window, getting their connection numbers...
'then matches one server name against a name you put in
'via an InputBox, and lists the active users on that server.
'Of course, you'll want to change the public const
' UserServerNameDefault to something on your system.
'Note: nConnMaxUsed on my system reports a number below
'the actual number of connections sometimes, so I've used
'the arbitrary figure of 250 max connections.
'
'Of course, this goes into a .bas module.  You don't need
'a form as long as sub Main is set as the default startup.

'I didn't wait to see if you rejected brosenb0's ans...
'I figure info exchange is more important than points.


Option Explicit
'UserIDs ... minimal code to get list of users

Declare Function NWCallsInit Lib "calwin32" _
   (notUsed1 As Any, notUsed2 As Any) As Long

Declare Function NWCCScanConnRefs Lib "CLXWIN32" _
   (scanIterator As Long, connRef As Long) As Long

Declare Function NWCCGetConnRefInfoString Lib "CLXWIN32" _
   Alias "NWCCGetConnRefInfo" (ByVal connRef As Long, _
   ByVal infoType As Long, _
   ByVal infoLen As Long, _
   ByVal buffer As String) As Long
   
Declare Function NWCCOpenConnByRef Lib "CLXWIN32" _
   (ByVal connRef As Long, _
   ByVal openState As Long, _
   ByVal Reserved As Long, _
         connHandle As Long) As Long
     
Declare Function NWGetFileServerInformation Lib "calwin32" ( _
        ByVal conn As Long, _
        ByVal serverName As String, _
        majorVer As Byte, _
        minVer As Byte, _
        rev As Byte, _
        maxConns As Integer, _
        maxConnsUsed As Integer, _
        connsInUse As Integer, _
        numVolumes As Integer, _
        SFTLevel As Byte, _
        TTSLevel As Byte) As Long

Declare Function NWGetConnectionInformation Lib "calwin32" ( _
   ByVal conn As Long, _
   ByVal connNum As Integer, _
   ByVal objName As String, _
   objType As Integer, _
   objID As Integer, _
   loginTime As Byte) As Long
   
Declare Function NWCCCloseConn Lib "CLXWIN32" _
   (ByVal connHandle As Long) As Long
   
Public Const SUCCESS As Long = &H0
   
Public Const NWCC_TRAN_TYPE_IPX = 1
Public Const NWCC_TRAN_TYPE_UDP = 2
Public Const NWCC_TRAN_TYPE_DDP = 3
Public Const NWCC_TRAN_TYPE_ASP = 4

Public Const NWCC_OPEN_LICENSED = 1
Public Const NWCC_OPEN_UNLICENSED = 2

Public Const NWCC_INFO_SERVER_NAME = 7
Public Const NW_MAX_SERVER_NAME_LEN As Long = 49
 
Public Const NetConnMax = 250
'max licensed conns to search
'...nConnMaxUsed...seems to be too low for me...
'change server name to your default
Public Const UserServerNameDefault = "MHS_MEDIA"
Public UserServerName$
Public UserServerConnRef As Long

Public Sub ListServers()
' Get connected servers
Dim lRet&, lIterator&, lConnRef&, lTemp&
Dim sBuff As String * NW_MAX_SERVER_NAME_LEN
Dim sSrvName As String
Do
   ' lIterator is initialized to zero automatically
   lRet = NWCCScanConnRefs(lIterator, lConnRef)
   If lRet <> SUCCESS Then Exit Do
   lRet = NWCCGetConnRefInfoString( _
      lConnRef, _
      NWCC_INFO_SERVER_NAME, _
      NW_MAX_SERVER_NAME_LEN, _
      sBuff)
   
   If lRet = SUCCESS Then
      lTemp = InStr(1, sBuff, vbNullChar)
      sSrvName = Left(sBuff, lTemp - 1)
      Debug.Print sSrvName
     
      If UCase(sSrvName) = UCase(UserServerName) Then _
         UserServerConnRef = lConnRef
   End If
Loop
End Sub

Private Sub ListUsers()
Dim i%, i1%, i2%, i3%
Dim hConn&, nConnRef&, objID%, nRetcode&
Dim nConnMaxUsed%, objType%
Dim strServerName As String * NW_MAX_SERVER_NAME_LEN
Dim strBuffer As String * 255
Dim strUserName As String, sTemp As String
Dim loginTime(7) As Byte
Dim b1 As Byte, b2 As Byte, b3 As Byte, b4 As Byte, b5 As Byte

nConnRef = UserServerConnRef 'the one selected by the user
nRetcode = NWCCOpenConnByRef(nConnRef, NWCC_OPEN_LICENSED, NWCC_TRAN_TYPE_IPX, hConn)
If nRetcode = SUCCESS Then
   nRetcode = NWGetFileServerInformation( _
      hConn, strBuffer, b1, b2, b3, i1, nConnMaxUsed, i2, i3, b4, b5)
   If nRetcode = SUCCESS Then
      '?? nConnMaxUsed seems to be less than needed sometimes...
      '   so use arbitrarily high number...
      For i = 0 To NetConnMax    'normal use: nConnMaxUsed here
         nRetcode = NWGetConnectionInformation(hConn, i, strBuffer, objType, objID, loginTime(0))
         If nRetcode = SUCCESS Then
            strBuffer = Left$(strBuffer, InStr(1, strBuffer, vbNullChar) - 1)
            strUserName = RTrim(strBuffer)
            Debug.Print strUserName
         End If
      Next i
   End If
   NWCCCloseConn (hConn)
End If
End Sub

Sub Main()
Dim lRetCode As Long
lRetCode = NWCallsInit(0, 0)
If lRetCode <> SUCCESS Then
   MsgBox "Unable to initialize NWCallsInit", _
      vbInformation, "Startup Problem"
   End
End If
UserServerName = InputBox("Server Name for UserList", _
   "Enter Server Name", UserServerNameDefault)
   
ListServers
ListUsers
Stop

End Sub


0
 

Author Comment

by:jshafer
ID: 1593732
This comment is for jtest.  Thanks for your post.  I ended up giving the points to brosenbo since he give me the response I really needed.  I tried the your code, and it gives me a list of connected users, what I was really hunting for was a list of all users and their contexts.

I do really like your code though, and wanted to say thanks for it.
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
INetware 6.5 and xserver integration 5 281
hp laserjet 9050 printer control 8 599
HP 2035n printer not printing in IPrint. LPR communication error 36 4 1,023
Microsoft Word and UAC 11 1,503
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question