|
-
Apr 18th, 2000, 11:21 PM
#1
Hi,
1. How do i get a list of all the NT domains available thru my VB code, which is the API call that i have to make?
2. How do i get the list of all NT users in a particular domain?Again the name of the API that i may have to use?
Something like when i log into a NT workstation(ctrl+alt+del), i get a list of the available domains, i want a similar list of all the domains that is available.
Thanks,
Desi
-
Apr 19th, 2000, 01:50 AM
#2
New Member
You might want to look into ADSI. With ADSI, you can enumerate Domains,Computers, and Users. In addition it gives you a number of other advantages when working with these areas.
-
Apr 19th, 2000, 01:54 AM
#3
Hi Hudgi,
What is ADSI??Could u please elaborate.
Thanks,
Desi
-
Apr 19th, 2000, 02:07 AM
#4
New Member
ADSI is Active Directory Services Interface. It's a product by Microsoft and works in conjunction with VB. You can Download ADSI from Microsoft. It allows you to access and modifiy NT related components without bulky coding.
Example: ( This Enumerations Computers from a Domain)
'-- Declarations
Dim Domain As IADsContainer
Dim comp As IADsComputer
Dim vfilter As Variant
'-- Initialize
Set Domain = GetObject("WinNT://" & sDomainName)
vfilter = Array("computer")
Domain.Filter = vfilter
'--
' Error Trapping
On Error GoTo errhandler
'--
'--Information Settings
FrmMain.StatusBar1.Panels.Item(1).Text = "Enumerating Computers, Please Wait"
FrmMain.StatusBar1.Refresh
Dim nodX As Node
Dim x
Dim i As Long, j As Long, k As Long
With FrmMain.TreeView1
With .Nodes
For Each comp In Domain
Set nodX = .Add(sDomainName & Computers",tvwChild,sDomainName & comp.Name, comp.Name, 22, 22)
Next comp
End With
End With
'--
' Resets the Variables Used by the Application
FrmMain.TreeView1.SelectedItem.Expanded = True
FrmMain.StatusBar1.Panels.Item(1).Text = ""
FrmMain.StatusBar1.Refresh
FrmMain.MousePointer = vbDefault
Exit Sub
errhandler:
FrmMain.StatusBar1.Panels.Item(1).Text = "A Error has occured, Please Check Settings"
FrmMain.StatusBar1.Refresh
FrmMain.MousePointer = vbDefault
-
Apr 19th, 2000, 02:10 AM
#5
New Member
There is website that has alot of examples and code snippets
http://www.netfokus.dk/vbadmincode/
-
Apr 19th, 2000, 02:17 AM
#6
Thanks pal.I will go thru the site
-
Apr 19th, 2000, 02:25 AM
#7
Hey hudgi what is that sdomainNmae in ur code??
I kindof dont have time now to go thru the site that u have mentioned.I hope ur code helps.
-
May 3rd, 2000, 09:20 PM
#8
New Member
Problem with adsi functions and getobject
Hi ,
Even i have a similar problem, can you help me with it
I need to my program to pause, resume or cancel any job in the print queue. I am trying to use the ADSI functions to achieve this functionality. But I am having problems trying to use getobject function to access the print queue on my printer.
I get an error saying "Automation Error . Invalid syntax". My souce code is :
Dim pq as IADsPrintQueue
Dim pqo as IADsPrintQueueOperations
Dim pj as IADsPrintJob
Set pq = GetObject("WinNT://domain_name/computer_name/printer_name")
(I get error at the above statement)
Set pqo = pj
for each pj in pqo.PrintJobs
....
..
next
Can you help me with this ?
Thanks in advance for your help
Kamal
-
May 3rd, 2000, 09:45 PM
#9
Lively Member
search MSDN for netapi32.dll and it will give you a ton of information on how to get whatever information you want from a windows network and windows machines.. there's also some article here but I don't have the path to it at the moment.
-
May 4th, 2000, 07:46 PM
#10
New Member
Thanks a lot. But I found out my mistake. I had not installed adsi on my computer. I know its an obvious thing to install it if you are using its function, but thought i would just put it here, so that anybody else does not face the same problem.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|