Help and Support
 

powered byLive Search

How To Get Computer Information Using ADSI

Article ID:197947
Last Review:October 9, 2006
Revision:4.0
This article was previously published under Q197947
On This Page

SUMMARY

You can use the Active Directory Service Interfaces (ADSI) to obtain network computer information from within Visual FoxPro. This article shows an example of how to obtain this information.

Back to the top

MORE INFORMATION

NOTE: To use the following example, you must install the Active Directory Service Interfaces from the following Web site or the Microsoft Developer Network CD:
http://www.microsoft.com/technet/prodtechnol/windows2000serv/technologies/activedirectory/default.mspx (http://www.microsoft.com/technet/prodtechnol/windows2000serv/technologies/activedirectory/default.mspx)
ADSI is a COM-based interface for accessing directory services. You can treat each element of the network, such as users, printers, and computers, as an object. Accessing the properties of the computer object allows the developer to get information about the computer. The following code demonstrates how to do this. Save the following code to a program file and run the program.

Back to the top

Sample Code

*-- Code begins here.
*-- Change MyDomain and MyComputer to valid domain and computer names.
oComputer = GetObject("WinNT://MyDomain/MyComputer")

*-- Get the properties for the oComputer object and display them.
lsInfo = "GUID:  " + oComputer.GUID + CHR(13) +;

         "Owner:  " + oComputer.Owner + CHR(13) +;
         "Division:  " + oComputer.Division + CHR(13) +;
         "Operating System:  " + oComputer.OperatingSystem + CHR(13) +;
         "OS Version:  " + oComputer.OperatingSystemVersion + CHR(13) +;
         "Processor:  " + oComputer.Processor + CHR(13) +;
         "Processor Count:  " + oComputer.ProcessorCount

WAIT WINDOW lsInfo
*-- Code ends here.
				

Back to the top

REFERENCES

Visual Studio Microsoft Developer Network Library, version 6.0; search on: "ADSI Computer Object"

For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:
http://msdn.microsoft.com/ie/ (http://msdn.microsoft.com/ie/)

http://support.microsoft.com/iep (http://support.microsoft.com/iep)

Back to the top


APPLIES TO
Microsoft Visual FoxPro 6.0 Professional Edition
Microsoft Active Directory Service Interfaces 2.5

Back to the top

Keywords: 
kbhowto KB197947

Back to the top

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by E-mail, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.