Solved

create a list of users and contexts

Posted on 1998-10-14
7
325 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
  • 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
eDir 88 Linux 16 1,459
How do I connect to Novel Netware via smb? 2 788
Novell Client Memory Leak Fix Needed 3 182
info on .FIL files  on novell netware 2 86
In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 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