How to Access Remote System Information in VB6

Written by jim campbell
  • Share
  • Tweet
  • Share
  • Email

Visual Basic 6 (VB6) programmers can create network-aware applications that query a remote computer's information and display it for the user. These programs are created for network administrators who need to manage several computers. The VB6 language has some functions and tools that let you query information from a remote computer on the network. You create this code in your Microsoft VB6 editor.

Skill level:
Moderate

Other People Are Reading

Instructions

  1. 1

    Double-click the VB6 project file on your computer. Your VB6 workspace automatically loads and the VB6 editor opens.

  2. 2

    Create the connection to the remote computer. The following code creates a connection to the "mycomputer" computer:

    Set wmi = GetObject("winmgmts: {impersonationLevel=Impersonate}!\mycomputer\root\cimv2")

  3. 3

    Log in to the remote computer. You must log in with an administrator account to query information from the computer. The following logs you in to the computer. Type it into your VB6 workspace:

    Set locator = CreateObject("WbemScripting.SWbemLocator")

    Set service = locator.ConnectServer ("mycomputer", "root\cimv2", "administrator", "password")

  4. 4

    Display the remote computer information. In this example, the first Windows service name is shown to the user. A service is a background program that runs on a Windows computer. The following displays the computer information:

    Set query = _ service.ExecQuery("Select * From Win32_Process")

    Wscript.Echo "Process Name: " & query.Name

  5. 5

    Click the "File" menu item and select "Save." To test your new code, click the VB6 "Run" button to run the program on your computer.

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.