It's whats inside that counts!

Dazz
04-25-2001, 10:58 AM
I guess this is going to be an API one (always remember to post in the right place) so here goes.

I want to run an inventory program on all PC's on my network.
I will put the install app on the server, and run it on the workstations from the login script.

What I want it to do is create a file containing info on the machine.
I know how to do the fundementals, but what I am looking for is some help on the API calls that I should be looking for that will tell me what processor is installed, how much RAM, Graphics card details, IP address, Login Name etc. If possible installed software titles would be nice (although I obviously know exactly what is on all the PC's on my network, and that it is all legal, ahem!).

Have any of you done this sort of thing before, I would imagine that it was quite a common want.

P.S. Intel do a product that does this sort of thing called LANDesk, for the full suit it costs around £8000 (that a sh!t load of Dollars), I aint paying that, I only want to run it once!

BillSoo
04-25-2001, 07:27 PM
I remember reading something about this...

Try http://www.thescarms.com/

Also, a simple way to get some of the information would be to use the SysInfo control. You could get more data from, say, the winsock control as well...

"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder

pponchot
04-26-2001, 12:32 PM
I saw an inventory program written in vb that runs like this either on www.planet-source-code.com or www.coderoom.com. From what I saw it was pretty neat. I meant to check it out but I got sidetracked with work (smile).

If you can't find it, let me know as I downloaded it and will have to search for it.

Phillip

p.s. that is a whole lot of dollars!

...And on that day, Lister, Satan will be ice skating to work.... Rimmer, Red Dwarf

Dazz
04-27-2001, 01:38 AM
Thanx guys!

I sort of know how to get some of the info, but need a complete list to really save me visiting every PC on the site (well, send someone round, the old why have a dog and bark yourself).

I will check out your suggestions, and let you know how I get on.

Dazz

whelanp
04-27-2001, 05:16 AM
For Harware details try

Private Declare Sub GetSystemInfo _
Lib "kernel32" _
(lpSystemInfo As SYSTEM_INFO)

Private Declare Function IsProcessorFeaturePresent _
Lib "kernel32" _
(ByVal ProcessorFeature As Long) _
As Long

Private Declare Function GetSystemMetrics _
Lib "user32" _
(ByVal nIndex As Long) _
As Long

Private Type SYSTEM_INFO
wProcessorArchitecture As Integer
wReserved As Integer
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
wProcessorLevel As Integer
wProcessorRevision As Integer
End Type

Private Const SM_SLOWMACHINE = 73

Private Const PF_FLOATING_POINT_PRECISION_ERRATA = 0
Private Const PF_FLOATING_POINT_EMULATED = 1
Private Const PF_COMPARE_EXCHANGE_DOUBLE = 2
Private Const PF_MMX_INSTRUCTIONS_AVAILABLE = 3

Public Enum EnumProcessorType
cmiIntel386 = 386
cmiIntel486 = 486
cmiIntelPENTIUM = 586
cmiMIPSR4000 = 4000
cmiALPHA21064 = 21064
End Enum

Public Enum EnumProcessorArchitecture
cmiIntel = 0
cmiMIPS = 1
cmiALPHA = 2
cmiPPC = 3
cmiUnknown = &HFFFF
End Enum


For memory stuff try

Private Declare Sub GlobalMemoryStatus _
Lib "kernel32" _
(lpBuffer As MemoryStatus)

Private Type MemoryStatus
dwLength As Long ' The size of the structure
dwMemoryLoad As Long ' Percent of memory in use
dwTotalPhys As Long ' bytes of physical memory
dwAvailPhys As Long ' bytes of free physical memory
dwTotalPageFile As Long ' bytes of paging file
dwAvailPageFile As Long ' bytes of free paging file
dwTotalVirtual As Long ' user bytes of address space
dwAvailVirtual As Long ' free user bytes
End Type

For OS type info

Private Declare Function GetUserDefaultLCID _
Lib "kernel32" () _
As Long

Private Declare Function GetLocaleInfo _
Lib "kernel32" _
Alias "GetLocaleInfoA" _
(ByVal Locale As Long, _
ByVal LCType As Long, _
ByVal lpLCData As String, _
ByVal cchData As Long) As Long

Private Declare Function CoCreateGuid _
Lib "ole32.dll" _
(pGUID As GUID) _
As Long

Private Declare Function SetComputerName _
Lib "kernel32" _
Alias "SetComputerNameA" _
(ByVal lpComputerName As String) _
As Long

Private Declare Function GetComputerName _
Lib "kernel32" _
Alias "GetComputerNameA" _
(ByVal lpBuffer As String, _
nSize As Long) _
As Long

Private Declare Function GetWindowsDirectory _
Lib "kernel32" _
Alias "GetWindowsDirectoryA" _
(ByVal lpBuffer As String, _
ByVal nSize As Long) _
As Long

Private Declare Function GetSystemDirectory _
Lib "kernel32" _
Alias "GetSystemDirectoryA" _
(ByVal lpBuffer As String, _
ByVal nSize As Long) _
As Long

Private Declare Function GetTempPath _
Lib "kernel32" _
Alias "GetTempPathA" _
(ByVal nBufferLength As Long, _
ByVal lpBuffer As String) _
As Long

Private Declare Function GetTempFileName _
Lib "kernel32" _
Alias "GetTempFileNameA" _
(ByVal lpszPath As String, _
ByVal lpPrefixString As String, _
ByVal wUnique As Long, _
ByVal lpTempFileName As String) _
As Long

Private Declare Function GetUserName _
Lib "advapi32.dll" _
Alias "GetUserNameA" _
(ByVal lpBuffer As String, _
nSize As Long) _
As Long

Private Declare Function GetVersionEx _
Lib "kernel32" _
Alias "GetVersionExA" _
(lpVersionInformation As OSVERSIONINFO) _
As Long

Private Declare Function GetDeviceCaps _
Lib "gdi32" _
(ByVal hdc As Long, _
ByVal nIndex As Long) _
As Long

Private Declare Function GetDC _
Lib "user32" _
(ByVal hwnd As Long) _
As Long

Private Declare Function ReleaseDC _
Lib "user32" _
(ByVal hwnd As Long, _
ByVal hdc As Long) _
As Long

Private Declare Function SystemParametersInfo _
Lib "user32" _
Alias "SystemParametersInfoA" _
(ByVal uAction As Long, _
ByVal uParam As Long, _
lpvParam As Long, _
ByVal fuWinIni As Long) _
As Long

Private Declare Function GetCurrentHwProfile _
Lib "advapi32" _
Alias "GetCurrentHwProfileA" _
(HwProfileInfo As HW_PROFILE_INFO) _
As Long

Private Declare Function RegOpenKeyEx _
Lib "advapi32.dll" _
Alias "RegOpenKeyExA" _
(ByVal lngHKey As Long, _
ByVal lpSubKey As String, _
ByVal ulOptions As Long, _
ByVal samDesired As Long, _
phkResult As Long) _
As Long

Private Declare Function RegQueryValueExString _
Lib "advapi32.dll" _
Alias "RegQueryValueExA" _
(ByVal lngHKey As Long, _
ByVal lpValueName As String, _
ByVal lpReserved As Long, _
lpType As Long, _
ByVal lpData As String, _
lpcbData As Long) _
As Long

Private Declare Function RegQueryValueExLong _
Lib "advapi32.dll" _
Alias "RegQueryValueExA" _
(ByVal lngHKey As Long, _
ByVal lpValueName As String, _
ByVal lpReserved As Long, _
lpType As Long, _
lpData As Long, _
lpcbData As Long) _
As Long

Private Declare Function RegQueryValueExBinary _
Lib "advapi32.dll" _
Alias "RegQueryValueExA" _
(ByVal lngHKey As Long, _
ByVal lpValueName As String, _
ByVal lpReserved As Long, _
lpType As Long, _
ByVal lpData As Long, _
lpcbData As Long) _
As Long

Private Declare Function RegQueryValueExNULL _
Lib "advapi32.dll" _
Alias "RegQueryValueExA" _
(ByVal lngHKey As Long, _
ByVal lpValueName As String, _
ByVal lpReserved As Long, _
lpType As Long, _
ByVal lpData As Long, _
lpcbData As Long) _
As Long

Private Declare Function RegCloseKey _
Lib "advapi32.dll" _
(ByVal lngHKey As Long) _
As Long

Private Const HW_PROFILE_GUIDLEN = 39
Private Const MAX_PROFILE_LEN = 80
Private Const MAX_PATH = 260

Private Const BITSPIXEL = 12
Private Const PLANES = 14
Private Const LOGPIXELSX& = 88

Private Const VER_PLATFORM_WIN32_NT = 2
Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Const VER_PLATFORM_WIN32s = 0

Private Const SPI_GETBEEP = 1
Private Const SPI_SETBEEP = 2
Private Const SPI_GETWORKAREA = 48
Private Const SPI_GETSCREENSAVEACTIVE = 16
Private Const SPI_GETSCREENSAVETIMEOUT = 14
Private Const SPI_SETSCREENSAVEACTIVE = 17
Private Const SPI_SETSCREENSAVETIMEOUT = 15
Private Const SPIF_SENDWININICHANGE = &H2

Private Const DOCKINFO_UNDOCKED = 1
Private Const DOCKINFO_DOCKED = 2
Private Const DOCKINFO_USER_SUPPLIED = 4
Private Const DOCKINFO_USER_UNDOCKED = 5
Private Const DOCKINFO_USER_DOCKED = 6
Private Const LOCALE_SENGLANGUAGE = &H1001 ' English name of language

'Registry

Private Const HKEY_CLASSES_ROOT = &H80000000
Private Const HKEY_CURRENT_USER = &H80000001
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const HKEY_USERS = &H80000003

Private Const mcregErrorNone = 0
Private Const mcregErrorBadDB = 1
Private Const mcregErrorBadKey = 2
Private Const mcregErrorCantOpen = 3
Private Const mcregErrorCantRead = 4
Private Const mcregErrorCantWrite = 5
Private Const mcregErrorOutOfMemory = 6
Private Const mcregErrorInvalidParameter = 7
Private Const mcregErrorAccessDenied = 8
Private Const mcregErrorInvalidParameterS = 87
Private Const mcregErrorNoMoreItems = 259

Private Const mcregKeyAllAccess = &H3F
Private Const mcregKeyQueryValue = &H1

Private Const mcregOptionNonVolatile = 0
Private Const mcregSZ As Long = 1
Private Const mcregBinary As Long = 3
Private Const mcregDWord As Long = 4

Private Type HW_PROFILE_INFO
dwDockInfo As Long
szHwProfileGuid As String * HW_PROFILE_GUIDLEN
szHwProfileName As String * MAX_PROFILE_LEN
End Type

Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128 ' Maintenance string for PSS usage
End Type

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(7) As Byte
End Type

Public Enum EnumWindowsType
OSIWindows32s = 0
OSIWindows95 = 1
OSIWindowsNT = 2
End Enum


I've more for Keyboard and Mouse info if required

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum