Computer info
Ivan F Moala
Google
Can Do
Goto Guest book sign in page [Home]
Greatest place to be
Thanks for visiting my site lucky visitor:
This page was last updated on: April 25, 2006
Copyright © 2002. XcelFiles. All Rights Reserved Ivan F Moala
Tell a friend about this page
Use WMI to get info on your computer system eg. Name, Type, Manufacturer, Model,
ram, Domain, role, Current User.

PC and server systems in an enterprise network benefit from well-instrumented computer software and hardware, which allow system components to be monitored and controlled, both locally and remotely. Microsoft has provided for this with the WMI = Windows Management Instrumentation (formerly known as WBEM Web-based Enterprise management)
The WMI infrastructure ships in Windows 98 (although I could not get the routines to fire in win98 ??), Microsoft Windows NT® 4.0 SP4, Windows 2000, and Windows XP. It also is supported on Windows 95. It runs as the "Windows Management" Service.
Sub SysInfo()

Dim s As String, oSystem As Object, item As Object

Set oSystem = GetObject("winmgmts:").instancesOf("Win32_ComputerSystem")

For Each item In oSystem
s = "Computer Info" & vbCrLf
s = s & "-------------------------------" & vbCrLf
s = s & "Name: " & item.Name & vbCrLf
s = s & "Status: " & item.Status & vbCrLf
s = s & "Type: " & item.SystemType & vbCrLf
s = s & "Mfg: " & item.Manufacturer & vbCrLf
s = s & "Model: " & item.Model & vbCrLf
s = s & "RAM: " & item.TotalPhysicalMemory \ 1024000 & "mb" & vbCrLf
s = s & "Domain: " & item.Domain & vbCrLf
s = s & "Role: " & TranslateDomainRole(item.DomainRole) & vbCrLf
s = s & "Current User: " & item.UserName & vbCrLf

MsgBox s
Next

Set oSystem = Nothing

End Sub

Function TranslateDomainRole(ByVal roleID) As String
Dim RetString As String

Select Case roleID
Case 0
RetString = "Standalone Workstation"
Case 1
RetString = "Member Workstation"
Case 2
RetString = "Standalone Server"
Case 3
RetString = "Member Server"
Case 4
RetString = "Backup Domain Controller"
Case 5
RetString = "Primary Domain Controller"
Case Else
RetString = "Unknown"
End Select

TranslateDomainRole = RetString

End Function