JSI Tip 8946. How can I collect system information from my clients in a logon script?
Jerold Schulman
January 18, 2005
2 Min Read
In tip 2597, I described the command line switches for Msinfo32.exe.
If I run "%commonProgramFiles%Microsoft SharedmsinfoMSINFO32.EXE" /categories systemsummary /report , the contains information similar to:
System Information report written at: 01/16/05 09:36:31System Name: JSI009[System Summary]ItemValueOS NameMicrosoft Windows XP ProfessionalVersion5.1.2600 Service Pack 2 Build 2600OS ManufacturerMicrosoft CorporationSystem NameJSI009System ManufacturerDell Computer CorporationSystem ModelPrecision WorkStation 650System TypeX86-based PCProcessorx86 Family 15 Model 2 Stepping 7 GenuineIntel ~2657 MhzProcessorx86 Family 15 Model 2 Stepping 7 GenuineIntel ~2657 MhzProcessorx86 Family 15 Model 2 Stepping 7 GenuineIntel ~2657 MhzProcessorx86 Family 15 Model 2 Stepping 7 GenuineIntel ~2657 MhzBIOS Version/DateDell Computer Corporation A04, 03/25/2004SMBIOS Version2.3Windows DirectoryC:WINDOWSSystem DirectoryC:WINDOWSsystem32Boot DeviceDeviceHarddiskVolume2LocaleUnited StatesHardware Abstraction LayerVersion = "5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)"User NameJSIINCJerryTime ZoneEastern Standard TimeTotal Physical Memory1,024.00 MBAvailable Physical Memory603.68 MBTotal Virtual Memory2.00 GBAvailable Virtual Memory1.96 GBPage File Space2.41 GBPage FileC:pagefile.sys
NOTE: You can also run the command on a remote computer using:
"%commonProgramFiles%Microsoft SharedmsinfoMSINFO32.EXE" /computer NAME /categories systemsummary /report
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 offsetlocalif exist "%LOGONSERVER%INFO32%ComputerName%.txt" goto continueset 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 SharedmsinfoMSINFO32.EXE" /categories systemsummary /report %file%set what=1for /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:stripif {%1}=={} goto strip1set work=%work% %1shiftgoto strip:strip1set work=%work:(={%set work=%work:)=}%goto stripw%what%:stripw1set OSM=%work:~9%set work=set what=2goto :EOF:stripw2set SYSM=%work:~21%set work=set what=3goto :EOF:stripw3set MDL=%work:~14%set work=set what=4goto :EOF:continueendlocal
About the Author
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
You May Also Like