Go Back   Access World Forums > Microsoft Access Reference > Code Repository

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-26-2018, 07:03 AM   #1
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 7,358
Thanks: 92
Thanked 1,812 Times in 1,687 Posts
isladogs is a glorious beacon of light isladogs is a glorious beacon of light isladogs is a glorious beacon of light isladogs is a glorious beacon of light isladogs is a glorious beacon of light
Obtain detailed system info about your PC

A recent thread comparing DBEngine(0)(0) vs CurrentDB prompted me to put together a simple app for collecting detailed information about a computer system.

Until now, I have used a number of functions using WMI and other approaches to obtain this information.
However, I've now managed to obtain code that will collect almost all this information in one place.

When first run, this will run a routine to populate a table tblSysInfo containing details of your computer system / processor / BIOS / each hard drive or logical disk.

As there is a lot of information this may take 10-20 seconds (less if you have a shiny new PC!).
The most useful parts are then copied into the table tblComputerInfo and displayed in the form frmComputerInfo so it is instantly available in future. For example:



Table tblSysInfo has the following fields:
ID (autonumber PK), wmi (text 50), Computer(text 50), Property (text 50), PropertyValue (text 50)

The code used to populate it is based on something I found online (at Stackoverflow?) & adapted slightly:

Code:
Sub GetSysInfo()

  Dim strComputer As String
  Dim WMI(5) As String
  Dim objWMIService As Object
  Dim colItems As Object
  Dim objItem As Object
  Dim strProcessorIDs As String
  Dim Cnt As Integer, I As Integer, obj As Object
  
  WMI(0) = "Win32_Processor"
  WMI(1) = "Win32_ComputerSystem"
  WMI(2) = "Win32_BIOS"
  WMI(3) = "Win32_LogicalDisk"
  
  strComputer = "localhost"

  Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  
  CurrentDb.Execute "DELETE * FROM tblSysInfo"
  
  On Error Resume Next
  For I = LBound(WMI) To UBound(WMI)
    Cnt = 1
    Set colItems = objWMIService.ExecQuery("SELECT * FROM " & WMI(I) & "", , 48)
  
    For Each objItem In colItems
      
      For Each obj In objItem.properties_
        
        CurrentDb.Execute "INSERT INTO tblSysInfo(WMI, Computer, Property, PropertyValue )" & _
            " VALUES (""" & WMI(I) & Cnt & """,""" & strComputer & """,""" & obj.Name & """,""" & obj.Value & """)", dbFailOnError
      Next
      Cnt = Cnt + 1
    Next
  Next I
  
  Set objItem = Nothing
  Set colItems = Nothing
  Set objWMIService = Nothing

End Sub
On my PC, this creates around 520 records

The summary table tblComputerInfo has these fields and 1 record:
ID (autonumber PK), ComputerName (text 20), Processor (text 100), RAM (text 50), OperatingSystem (text 50), AccessVersion (text 50)

To use this in your own applications, copy ALL the following items:
1. Both tables tblSysInfo and tblComputerInfo
2. Form frmComputerInfo
3. Module modSysInfo

These items are OPTIONAL:
4. Both queries - used for clearing the data in each table
5. Module modResizeForm - used to resize the form(s) for any screen resolution.
If you don't want to use it, remove the line ResizeForm Me from the Form_Open event and resize the form 'manually' as required.

I hope this is useful to others.
It could possibly be helpful to include a similar screenshot for your own computer if you are posting about performance issues with Access.

As this is a moderated area, please send me a PM if you have any questions or issues with this utility.

HINT: Some of the information in tblSysInfo will be very useful if you are attempting Security Challenge #2
Attached Images
File Type: png SystemInfo.PNG (18.7 KB, 209 views)
Attached Files
File Type: zip SystemInfo.zip (115.7 KB, 39 views)

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Previously known as ridders : Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Last edited by isladogs; 08-26-2018 at 11:40 AM. Reason: Extra info
isladogs is offline   Reply With Quote
Reply

Tags
detailed system info

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Obtain field info when a "return" is used NLR Queries 3 02-07-2014 10:56 AM
One box in detailed section finbarr33 Reports 2 05-28-2011 05:54 AM
creating a detailed info pop up out of listbox EnglisAP Forms 2 01-11-2011 05:22 AM
Tip New Tool (System Info) boblarson General 0 12-21-2009 01:01 PM
working on inventory system but can't get the drop box to change other info scottsman71 Forms 0 03-31-2001 11:47 PM




All times are GMT -8. The time now is 05:58 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World