Skip navigation

JSI Tip 8946. How can I collect system information from my clients in a logon script?


In tip 2597, I described the command line switches for Msinfo32.exe.

If I run "%commonProgramFiles%\Microsoft Shared\msinfo\MSINFO32.EXE" /categories systemsummary /report <File Name>, the <File Name> contains information similar to:

System Information report written at: 01/16/05 09:36:31
System Name: JSI009
\[System Summary\]

Item	Value	
OS Name	Microsoft Windows XP Professional	
Version	5.1.2600 Service Pack 2 Build 2600	
OS Manufacturer	Microsoft Corporation	
System Name	JSI009	
System Manufacturer	Dell Computer Corporation	
System Model	Precision WorkStation 650	
System Type	X86-based PC	
Processor	x86 Family 15 Model 2 Stepping 7 GenuineIntel ~2657 Mhz	
Processor	x86 Family 15 Model 2 Stepping 7 GenuineIntel ~2657 Mhz	
Processor	x86 Family 15 Model 2 Stepping 7 GenuineIntel ~2657 Mhz	
Processor	x86 Family 15 Model 2 Stepping 7 GenuineIntel ~2657 Mhz	
BIOS Version/Date	Dell Computer Corporation A04, 03/25/2004	
SMBIOS Version	2.3	
Windows Directory	C:\WINDOWS	
System Directory	C:\WINDOWS\system32	
Boot Device	\Device\HarddiskVolume2	
Locale	United States	
Hardware Abstraction Layer	Version = "5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)"	
User Name	JSIINC\Jerry	
Time Zone	Eastern Standard Time	
Total Physical Memory	1,024.00 MB	
Available Physical Memory	603.68 MB	
Total Virtual Memory	2.00 GB	
Available Virtual Memory	1.96 GB	
Page File Space	2.41 GB	
Page File	C:\pagefile.sys
NOTE: You can also run the command on a remote computer using:

"%commonProgramFiles%\Microsoft Shared\msinfo\MSINFO32.EXE" /computer NAME /categories systemsummary /report <File Name>

Where NAME is the NetBIOS name or IP Address of the remote computer.

Following is an example of the commands you could include in a logon script to record OS Name, System Manufacturer, and System Model to a "%LOGONSERVER%\INFO32\%ComputerName%.txt" file, where INFO32 is the writeable share on each %LOGONSERVER%:

@echo off
setlocal
if exist "%LOGONSERVER%\INFO32\%ComputerName%.txt" goto continue
set file="%TEMP%\MSInfo32_%RANDOM%.tmp"
set srch="%TEMP%\MSInfo32_%RANDOM%.tmp"
(
@echo OS Name
@echo System Manufacturer
@echo System Model
)>%srch%
if exist %file% del /q %file%
"%commonProgramFiles%\Microsoft Shared\msinfo\MSINFO32.EXE" /categories systemsummary /report %file%
set what=1
for /f "Tokens=*" %%a in ('type %file%^|FINDSTR /B /G:%srch%') do (
 for /f "Tokens=1-8" %%i in ('@echo %%a') do (
 call :strip %%i %%j %%k %%l %%m %%n %%o %%p
 )
)
@echo "%OSM%" "%SYSM%" "%MDL%">"%LOGONSERVER%\INFO32\%ComputerName%.txt"
del /q %file%
del /q %srch%
goto continue
:strip
if \{%1\}==\{\} goto strip1
set work=%work% %1
shift
goto strip
:strip1
set work=%work:(=\{%
set work=%work:)=\}%
goto stripw%what%
:stripw1
set OSM=%work:~9%
set work=
set what=2
goto :EOF
:stripw2
set SYSM=%work:~21%
set work=
set what=3
goto :EOF
:stripw3
set MDL=%work:~14%
set work=
set what=4
goto :EOF
:continue
endlocal



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish