FINDSTR Start Point For Inventory

Dell/hps / VARIOUS
March 31, 2009 at 23:59:58
Specs: Windows XP, 3.39 GHz
Good evening,

I have started writing a script which will allow me to inventory the software at our site (nearly 400 machines) and then filter those results, using an inputted software title of some sort.

The resulting format I am hoping to output to the Results.txt text file is:

Computer Name 1:
Software result 1
Software result 2
Software result 3

Computer Name 2:
Software result 1
Software result 2
Software result 3

The results I am achiving at the moment are more like:

Computer Name 1:
Registered organization: Home Office
Compatibility Pack for the 2007 Office system 12.0.6215.1000
Microsoft Office 2003 Resource Kit 11.0.5614.0
Microsoft Office Professional Edition 2003 11.0.8173.0

Computer Name 2:
Registered organization: Home Office
Compatibility Pack for the 2007 Office system 12.0.6215.1000
Microsoft Office 2003 Resource Kit 11.0.5614.0
Microsoft Office Professional Edition 2003 11.0.8173.0
Compatibility Pack for the 2007 Office system 12.0.6215.1000
Microsoft Office 2003 Resource Kit 11.0.5614.0
Microsoft Office Professional Edition 2003 11.0.8173.0
OpenOffice.org 3.0 3.0.9379

Whereas the first four items under Computer Name 2 are repeats of the search results found under Computer Name 1. Everything else the script is supposed to do, it is doing correctly.

Because the full software inventory results have been written to one text file (temp.txt, which is probably just as well considering the number of computers searching against), and because of my loop structure, the FINDSTR command ends up searching the text file again from the beginning, each consecutive loop, resulting in the duplicated results.

As the formatting of the temp.txt text file is:

System information for \\Computer 1:
Additional hardware info about that machine
Applications installed on that machine

System information for \\Computer 2:
Additional hardware info about that machine
Applications installed on that machine

Would it be is possible to specify that each consecutive search begins after the line "System information for \\Computer #" (whereas the computer name is a unique value that can be identified)? Or is there a better way to structure the meat of this script so that the duplicate results have been eliminated?

---------------------------- SCRIPT --------------------------

@ECHO OFF

ECHO.

IF EXIST temp.txt DEL temp.txt

SET /P CLEAR_TXT=Clear Results.txt before starting new search? (y/n) 

IF NOT %CLEAR_TXT%==n IF EXIST Results.txt DEL /Q /F Results.txt

ECHO.

ECHO Please specify a software title to filter by (partial title names OK) or,
ECHO if none, please press the Enter key on your computer keyboard:

ECHO.

SET /P FILTER=

ECHO.

CLS

ECHO.

ECHO Performing a software inventory on these machines
ECHO With the filter in place: %FILTER%

SETLOCAL 
SET key= 
FOR /F "Tokens=*" %%a IN ('type PCs.txt') DO SET line=%%a&call :PARSE 
ENDLOCAL
GOTO END 

:PARSE
::STRIP COMMAND CONTROL CODES 
SET work=%line:"=% 
SET work=%work::=% 
SET work=%work:(=% 
SET work=%work:)=% 
SET work=%work:^&=% 
SET work=%work:^|=% 
SET work=%work:^>=% 
SET work=%work:^<=% 
SET work=%work:^%=% 
SET work=%work:^!=% 
SET work=%work:^;=% 

::SAVE THE KEY
IF {%work:~0,1%}=={[} set key=%line%&goto :EOF
SET dw=%work:dword=% 
IF "%dw%" EQU "%work%" goto :EOF

SET filename=%line%
SET substring=%filename:~33,30% 
SET temp=%substring%
SET _string=%temp%
SET _endbit=%_string:*?=%
CALL SET _semiresult=%%_string:%_endbit%=%%
SET _result=%_semiresult:?=%

SET COMPUTERNAME=%line%

ECHO.>>temp.txt
PSINFO \\%COMPUTERNAME% -s>>temp.txt

ECHO %COMPUTERNAME%:>>Results.txt

FOR /F "TOKENS=* DELIMS= " %%b IN ('FINDSTR "%FILTER%" temp.txt') DO (

ECHO %%b>>Results.txt

)

ECHO.>>Results.txt

EXIT /B

:END

IF EXIST temp.txt DEL temp.txt

START Results.txt

---------------------------- SCRIPT --------------------------

Thanks much,

-Matt- :-)


See More: FINDSTR Start Point For Inventory

Report •


#1
April 1, 2009 at 02:07:59
show a sample of temp.txt

Report •

#2
April 1, 2009 at 02:24:32
Can you post part of temp.txt?


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#3
April 1, 2009 at 02:33:08
I gotta learn to think faster. LOL


=====================================
If at first you don't succeed, you're about average.

M2


Report •

Related Solutions

#4
April 1, 2009 at 02:45:42
here is how i am going to do it:

+C:\>type temp.txt|find/n "System information for \\xxx"
[178]System information for \\xxx:

then put into variables:
skip=178

then use a for loop to get that section

for /f "skip=%skip% delims=" %%a in (temp.txt) do (
echo %%a|find/v "System information" || goto:breakloop
)
:breakloop

it would be better if you save psinfo of each computer as each text file.
eg.
computerA.txt
computerB.txt
things would run faster since you use the filename as key index. you will need it, because we are talking about 400 machines.

and merging all the .txt files into single file is as simple as:
copy *.txt result.tmp


Report •

#5
April 1, 2009 at 07:59:41
Hi,

Thanks for your responses

Here is an example of the temp.txt text file PSINFO generates. Whereas the number of entries are only limited by the number of computers PSINFO is querying against.

System information for \\COMPUTER123:
Uptime: 0 days 15 hours 16 minutes 13 seconds
Kernel version: Microsoft Windows XP, Multiprocessor Free
Product type: Professional
Product version: 5.1
Service pack: 2
Kernel build number: 2600
Registered organization: ###
Registered owner: ###
Install date: 7/31/2008, 2:15:33 PM
Activation status: Error reading status
IE version: 6.0000
System root: C:\WINDOWS
Processors: 2
Processor speed: 1.9 GHz
Processor type: Intel(R) Pentium(R) Dual CPU E2180 @
Physical memory: 1012 MB
Video driver: Intel(R) G33/G31 Express Chipset Family
Applications:
32 Bit HP CIO Components Installer 2.1.4
3ivx MPEG-4 5.0.3 (remove only) 5.0.3
7-Zip 4.57
Accelerated Reader 5.12
Adobe Acrobat 5.0 5.0
Adobe Flash Player 10 ActiveX 10.0.12.36
Adobe Photoshop Album 2.0 Starter Edition 2.00.000
Adobe Photoshop Elements 2.0 2.0
Adobe Reader 7.0 7.0.0
Adobe Shockwave Player 11 11
Alt-Tab Task Switcher Powertoy for Windows XP 1.00.0001
Apple Mobile Device Support 1.1.4.7
Apple Software Update 2.0.2.92
AppleWorks 5 5.0
ArcSoft Camera Suite
ArcSoft Media Card Companion (Shared Components) 2.50.30
Audacity 1.2.6
AviSynth 2.5
BSPlayer
Bonjour 1.0.104
Boot Services
Broadcom Gigabit Integrated Controller 10.50.03
BufferChm 70.0.170.000
CP_CalendarTemplates1 70.0.170.000
CP_Package_Basic1 70.0.170.000
CP_Panorama1Config 70.0.170.000
Camera Window 4.1.1
Canon Camera WIA Driver 5.0.5
Canon Camera Window for ZoomBrowser EX 4.1.1
Canon PhotoRecord
Canon PowerShot S45 WIA Driver 5.0.5
Canon Utilities File Viewer Utility 1.2 1.2.2
Canon Utilities PhotoStitch 3.1 3.1.10
Canon Utilities RemoteCapture 2.7 2.7.2
Canon Utilities ZoomBrowser EX 04.01.00046
Compatibility Pack for the 2007 Office system 12.0.6215.1000
CueTour 70.0.170.000
Dell Resource CD 1.10.0000
Destinations 70.0.170.000
DeviceManagementQFolder 1.00.0000
DisplaySwitch Platinum 1.0
DocProc 8.0.0.0
DocProcQFolder 1.00.0000
FLV Player 2.0
File Viewer Utility 1.2.2 1.2.2
FileZilla (remove only)
FlipShare 4.0.6.31692
Free Launch Bar 1.0
FullDPAppQFolder 1.00.0000
Google Toolbar for Internet Explorer 4.0.0.002
Google Toolbar for Internet Explorer
Google Updater 2.4.1536.6592
Gordian Knot Rip Pack 0.35.0 0.35.0
HEAT 6.40.184.0
HP Designjet T610 Printer Series
HP Imaging Device Functions 7.0 7.0
HP Photosmart Essential 1.9.1.3
HP Photosmart Premier Software 6.5 6.5
HP Printer Utility 1.4.1.16
HP Proactive Services 1.6.0.37
HP Scanjet G4000 series 8.0 8.0
HP Software Update 3.0.7.014
HP Solution Center 7.0 7.0
HP Web Registration 1.0.0.0
HPProductAssistant 70.0.170.000
HTML Search and Replace 1.01 1.01
Haali Media Splitter
High Definition Audio Driver Package - KB835221 20040219.000000
Hotfix for Windows XP (KB921411) 1
Hotfix for Windows XP (KB926239) 2
Icon Restore 1.0
ImageCast
InstantShareDevices 70.0.170.000
Intel(R) Graphics Media Accelerator Driver
J2SE Runtime Environment 5.0 Update 6 1.5.0.60
Java(TM) 6 Update 6 1.6.0.60
K-Lite Codec Pack 3.9.5 (Full) 3.9.5
KBOX 4.3.19642
LiveUpdate 3.2 (Symantec Corporation) 3.2.0.26
MSXML 4.0 SP2 (KB927978) 4.20.9841.0
MSXML 4.0 SP2 (KB936181) 4.20.9848.0
Macromedia Dreamweaver 8 8.0.0.2734
Macromedia Extension Manager 1.7.240
Macromedia Fireworks 8 8.0.0.777
Macromedia Flash 8 8.00.0000
Macromedia Flash 8 Video Encoder 1.00.0000
Macromedia Flash Player 8 8.0.22.0
Macromedia Flash Player 8 Plugin 8.0.22.0
McAfee Agent 4.0.0.1180
McAfee AntiSpyware Enterprise Module 8.5.0.163
McAfee VirusScan Enterprise 8.6.0
Media Card Companion
Merriam-Webster Online Toolbar
Microsoft .NET Framework 1.1 1.1.4322
Microsoft .NET Framework 1.1
Microsoft .NET Framework 1.1 Hotfix (KB928366)
Microsoft .NET Framework 2.0 Service Pack 1 2.1.21022
Microsoft Compression Client Pack 1.0 for Windows XP 1
Microsoft Office Professional Edition 2003 11.0.8173.0
Microsoft Script Debugger
Microsoft Silverlight 1.0.30401.0
Microsoft User-Mode Driver Framework Feature Pack 1.0
Microsoft Visual C++ 2005 Redistributable 8.0.50727.42
Microsoft Works 6-9 Converter 9.7.0621
Nero 6 Ultra Edition
Nero BurnRights
Notebook Software 10.0.124.0
OCR Software by I.R.I.S 8.0 8.0
OpenOffice.org 2.4 2.4.9310
PSD Employee Directory Quick Lookup 1.0.0
Palm Desktop and Synchronization Software
PanoStandAlone 70.0.170.000
Phoenix PXE Server
PhotoGallery 70.0.170.000
PhotoStitch 3.1.10
PowerDVD 7.0
QuickTime 7.4.5.67
RLPrintPlugin 1.0.3
RandMap 70.0.170.000
RealPlayer
RemoteCapture 2.7.2 2.7.2
Roxio Creator Audio 3.3.0
Roxio Creator Copy 3.3.0
Roxio Creator DE 3.3.0
Roxio Creator Data 3.3.0
Roxio Creator Tools 3.3.0
Roxio Drag-to-Disc 9.0
Roxio Express Labeler 2.1.0
Roxio Update Manager 3.0.0
SMART Board Drivers 10.0.124.0
SanDisk ImageMate Reader/Writer
Scan 8.1.0.0
ScannerCopy 8.0.0.0
Security Update for Windows Media Player (KB911564)
Security Update for Windows Media Player 10 (KB911565)
Security Update for Windows Media Player 10 (KB917734)
Security Update for Windows Media Player 10 (KB936782)
Security Update for Windows Media Player 6.4 (KB925398)
Security Update for Windows Media Player 9 (KB917734)
Security Update for Windows XP (KB883939) 1
Security Update for Windows XP (KB890046) 1
Security Update for Windows XP (KB893066) 2
Security Update for Windows XP (KB893756) 1
Security Update for Windows XP (KB896358) 1
Security Update for Windows XP (KB896422) 1
Security Update for Windows XP (KB896423) 1
Security Update for Windows XP (KB896424) 1
Security Update for Windows XP (KB896428) 1
Security Update for Windows XP (KB896688) 1
Security Update for Windows XP (KB899587) 1
Security Update for Windows XP (KB899588) 1
Security Update for Windows XP (KB899589) 1
Security Update for Windows XP (KB899591) 1
Security Update for Windows XP (KB900725) 1
Security Update for Windows XP (KB901017) 1
Security Update for Windows XP (KB901214) 1
Security Update for Windows XP (KB902400) 1
Security Update for Windows XP (KB903235) 1
Security Update for Windows XP (KB904706) 2
Security Update for Windows XP (KB905414) 1
Security Update for Windows XP (KB905749) 1
Security Update for Windows XP (KB905915) 1
Security Update for Windows XP (KB908519) 1
Security Update for Windows XP (KB911562) 1
Security Update for Windows XP (KB911567) 1
Security Update for Windows XP (KB911927) 1
Security Update for Windows XP (KB912812) 1
Security Update for Windows XP (KB912919) 1
Security Update for Windows XP (KB913446) 1
Security Update for Windows XP (KB913580) 1
Security Update for Windows XP (KB914388) 1
Security Update for Windows XP (KB914389) 1
Security Update for Windows XP (KB916281) 1
Security Update for Windows XP (KB917159) 1
Security Update for Windows XP (KB917344) 1
Security Update for Windows XP (KB917422) 1
Security Update for Windows XP (KB917953) 1
Security Update for Windows XP (KB918118) 1
Security Update for Windows XP (KB918439) 1
Security Update for Windows XP (KB918899) 1
Security Update for Windows XP (KB919007) 1
Security Update for Windows XP (KB920213) 1
Security Update for Windows XP (KB920214) 1
Security Update for Windows XP (KB920670) 1
Security Update for Windows XP (KB920683) 1
Security Update for Windows XP (KB920685) 1
Security Update for Windows XP (KB921398) 1
Security Update for Windows XP (KB921883) 1
Security Update for Windows XP (KB922616) 1
Security Update for Windows XP (KB922760) 1
Security Update for Windows XP (KB922819) 1
Security Update for Windows XP (KB923191) 1
Security Update for Windows XP (KB923414) 1
Security Update for Windows XP (KB923689)
Security Update for Windows XP (KB923694) 1
Security Update for Windows XP (KB923980) 1
Security Update for Windows XP (KB924191) 1
Security Update for Windows XP (KB924270) 1
Security Update for Windows XP (KB924496) 1
Security Update for Windows XP (KB924667) 1
Security Update for Windows XP (KB925454) 1
Security Update for Windows XP (KB925486) 1
Security Update for Windows XP (KB925902) 1
Security Update for Windows XP (KB926255) 1
Security Update for Windows XP (KB926436) 1
Security Update for Windows XP (KB927779) 1
Security Update for Windows XP (KB927802) 1
Security Update for Windows XP (KB928090) 1
Security Update for Windows XP (KB928255) 1
Security Update for Windows XP (KB928843) 1
Security Update for Windows XP (KB929123) 1
Security Update for Windows XP (KB929969) 1
Security Update for Windows XP (KB930178) 1
Security Update for Windows XP (KB931261) 1
Security Update for Windows XP (KB931768) 1
Security Update for Windows XP (KB931784) 1
Security Update for Windows XP (KB932168) 1
Security Update for Windows XP (KB933566) 1
Security Update for Windows XP (KB933729) 1
Security Update for Windows XP (KB935839) 1
Security Update for Windows XP (KB935840) 1
Security Update for Windows XP (KB936021) 1
Security Update for Windows XP (KB937894) 1
Security Update for Windows XP (KB938127) 1
Security Update for Windows XP (KB941202) 1
Security Update for Windows XP (KB941568) 1
Security Update for Windows XP (KB941569)
Security Update for Windows XP (KB941644) 1
Security Update for Windows XP (KB941693) 1
Security Update for Windows XP (KB943055) 1
Security Update for Windows XP (KB943460) 1
Security Update for Windows XP (KB943485) 1
Security Update for Windows XP (KB944338) 1
Security Update for Windows XP (KB944653) 1
Security Update for Windows XP (KB945553) 1
Security Update for Windows XP (KB946026) 1
Security Update for Windows XP (KB947864) 1
Security Update for Windows XP (KB948590) 1
Security Update for Windows XP (KB948881) 1
Security Update for Windows XP (KB958644) 1
Security Update for Windows XP (KB960714) 1
Silk 4.5.812
Silk 4.5 4.5.834
SkinsHP1 70.0.170.000
SlideShow 70.0.170.000
SoftChalk LessonBuilder3
SolutionCenter 70.0.170.000
Sonic Activation Module 1.0
Sonic_PrimoSDK 70.0.170.000
SoundMAX 5.10.01.5491
SpamBayes 1.0.4 1.0.4
Spybot - Search & Destroy 1.5.2
StuffIt Expander 6.0
Symantec Ghost Console Client 110.01.1533
Taskbar Shuffle version 2.5 2.5
The Core Media Player 4.0
Update for Windows XP (KB894391) 1
Update for Windows XP (KB896727) 1
Update for Windows XP (KB898461) 1
Update for Windows XP (KB900485) 2
Update for Windows XP (KB908531) 2
Update for Windows XP (KB910437) 1
Update for Windows XP (KB911280) 2
Update for Windows XP (KB916595) 1
Update for Windows XP (KB920872) 1
Update for Windows XP (KB922582) 1
Update for Windows XP (KB927891) 3
Update for Windows XP (KB929338) 1
Update for Windows XP (KB930916) 1
Update for Windows XP (KB931836) 1
Update for Windows XP (KB936357) 1
Update for Windows XP (KB938828) 1
Update for Windows XP (KB942763) 1
VobSub v2.23 (Remove Only)
WebFldrs XP 9.50.7523
WebReg 70.0.170.000
Winamp 5.53
Windows Driver Package - Hewlett-Packard Image (03/27/2007 8.3.0.0) 03/27/2007 8.3.0.0
Windows Genuine Advantage Notifications (KB905474) 1.7.0018.7
Windows Genuine Advantage Validation Tool (KB892130) 1.7.0069.2
Windows Genuine Advantage Validation Tool (KB892130)
Windows Installer 3.1 (KB893803) 3.1
Windows Media Format 11 runtime
Windows Media Format 11 runtime
Windows Media Player 11
Windows Media Player 11
Windows Server 2003 Administration Tools Pack 5.2.3790
Windows XP Hotfix - KB867282 20050127.090417
Windows XP Hotfix - KB873333 20050114.005213
Windows XP Hotfix - KB873339 20041117.092459
Windows XP Hotfix - KB885250 20050118.202711
Windows XP Hotfix - KB885835 20041027.181713
Windows XP Hotfix - KB885836 20041028.173203
Windows XP Hotfix - KB886185 20041021.090540
Windows XP Hotfix - KB887472 20041014.162858
Windows XP Hotfix - KB887742 20041103.095002
Windows XP Hotfix - KB887816 20041015.144805
Windows XP Hotfix - KB888113 20041116.131036
Windows XP Hotfix - KB888302 20041207.111426
Windows XP Hotfix - KB890047 20041221.124506
Windows XP Hotfix - KB890175 20041201.233338
Windows XP Hotfix - KB890859 1
Windows XP Hotfix - KB890923 1
Windows XP Hotfix - KB891781 20050110.165439
Windows XP Hotfix - KB893086 1
cp_OnlineProjectsConfig 70.0.170.000
cp_PosterPrintConfig 70.0.170.000
eSupportQFolder 1.00.0000
hpG4000 8.3.0.0
hpg4000QFolder 1.00.0000
iTunes 7.6.1.9
muvee Plugin 1.0 1.01.100

System information for \\COMPUTER345:
Uptime: 1 day 10 hours 52 minutes 45 seconds
Kernel version: Microsoft Windows XP, Multiprocessor Free
Product type: Professional
Product version: 5.1
Service pack: 2
Kernel build number: 2600
Registered organization: ###
Registered owner: ###
Install date: 7/31/2008, 2:15:02 PM
Activation status: Error reading status
IE version: 6.0000
System root: C:\WINDOWS
Processors: 2
Processor speed: 1.9 GHz
Processor type: Intel(R) Pentium(R) Dual CPU E2180 @
Physical memory: 2036 MB
Video driver: Intel(R) G33/G31 Express Chipset Family
Applications:
32 Bit HP CIO Components Installer 2.1.4
3ivx MPEG-4 5.0.3 (remove only) 5.0.3
7-Zip 4.57
Accelerated Reader 5.12
Adobe Acrobat 5.0 5.0
Adobe Flash Player ActiveX 9.0.124.0
Adobe Photoshop Album 2.0 Starter Edition 2.00.000
Adobe Photoshop Elements 2.0 2.0
Adobe Reader 8 8.0.0
Adobe Shockwave Player 11
Alt-Tab Task Switcher Powertoy for Windows XP 1.00.0001
Apple Mobile Device Support 1.1.4.7
Apple Software Update 2.0.2.92
AppleWorks 5 5.0
ArcSoft Camera Suite
ArcSoft Media Card Companion (Shared Components) 2.50.30
Audacity 1.2.6
AviSynth 2.5
BSPlayer
Bonjour 1.0.104
Boot Services
Broadcom Gigabit Integrated Controller 10.50.03
BufferChm 70.0.170.000
CP_CalendarTemplates1 70.0.170.000
CP_Package_Basic1 70.0.170.000
CP_Panorama1Config 70.0.170.000
Camera Window 4.1.1
Canon Camera WIA Driver 5.0.5
Canon Camera Window for ZoomBrowser EX 4.1.1
Canon PhotoRecord
Canon PowerShot S45 WIA Driver 5.0.5
Canon Utilities File Viewer Utility 1.2 1.2.2
Canon Utilities PhotoStitch 3.1 3.1.10
Canon Utilities RemoteCapture 2.7 2.7.2
Canon Utilities ZoomBrowser EX 04.01.00046
Compatibility Pack for the 2007 Office system 12.0.6215.1000
CueTour 70.0.170.000
Dell Resource CD 1.10.0000
Destinations 70.0.170.000
DeviceManagementQFolder 1.00.0000
DisplaySwitch Platinum 1.0
DocProc 8.0.0.0
DocProcQFolder 1.00.0000
FLV Player 2.0
File Viewer Utility 1.2.2 1.2.2
FileZilla (remove only)
Free Launch Bar 1.0
FullDPAppQFolder 1.00.0000
Google Toolbar for Internet Explorer 4.0.0.002
Google Toolbar for Internet Explorer
Google Updater 2.4.1536.6592
Gordian Knot Rip Pack 0.35.0 0.35.0
HEAT 6.40.184.0
HP Designjet T610 Printer Series
HP Imaging Device Functions 7.0 7.0
HP Photosmart Essential 1.9.1.3
HP Photosmart Premier Software 6.5 6.5
HP Printer Utility 1.4.1.16
HP Proactive Services 1.6.0.37
HP Scanjet G4000 series 8.0 8.0
HP Software Update 3.0.7.014
HP Solution Center 7.0 7.0
HP Web Registration 1.0.0.0
HPProductAssistant 70.0.170.000
HTML Search and Replace 1.01 1.01
High Definition Audio Driver Package - KB835221 20040219.000000
Hotfix for Windows XP (KB921411) 1
Hotfix for Windows XP (KB926239) 2
ID Cards Express 1.00.0000
Icon Restore 1.0
ImageCast
InstantShareDevices 70.0.170.000
Intel(R) Graphics Media Accelerator Driver
J2SE Runtime Environment 5.0 Update 6 1.5.0.60
Java(TM) 6 Update 6 1.6.0.60
Java(TM) 6 Update 7 1.6.0.70
K-Lite Codec Pack 4.7.0 (Full) 4.7.0
KBOX 4.3.19642
LiveUpdate 3.2 (Symantec Corporation) 3.2.0.26
MSXML 4.0 SP2 (KB927978) 4.20.9841.0
MSXML 4.0 SP2 (KB936181) 4.20.9848.0
Macromedia Dreamweaver 8 8.0.0.2734
Macromedia Extension Manager 1.7.240
Macromedia Fireworks 8 8.0.0.777
Macromedia Flash 8 8.00.0000
Macromedia Flash 8 Video Encoder 1.00.0000
Macromedia Flash Player 8 8.0.22.0
Macromedia Flash Player 8 Plugin 8.0.22.0
McAfee Agent 4.0.0.1180
McAfee AntiSpyware Enterprise Module 8.5.0.163
McAfee VirusScan Enterprise 8.6.0
Media Card Companion
Merriam-Webster Online Toolbar
Microsoft .NET Framework 1.1 1.1.4322
Microsoft .NET Framework 1.1
Microsoft .NET Framework 1.1 Hotfix (KB928366)
Microsoft .NET Framework 2.0 Service Pack 1 2.1.21022
Microsoft Compression Client Pack 1.0 for Windows XP 1
Microsoft Office Professional Edition 2003 11.0.8173.0
Microsoft Script Debugger
Microsoft Silverlight 1.0.30401.0
Microsoft User-Mode Driver Framework Feature Pack 1.0
Microsoft Visual C++ 2005 Redistributable 8.0.50727.42
Microsoft Works 7.0 07.02.0620
Nero 6 Ultra Edition
Nero BurnRights
NetOp Teacher
Notebook Software 10.0.124.0
OCR Software by I.R.I.S 8.0 8.0
OpenOffice.org 2.4 2.4.9310
PSD Employee Directory Quick Lookup 1.0.0
Palm Desktop and Synchronization Software
PanoStandAlone 70.0.170.000
Phoenix PXE Server
PhotoGallery 70.0.170.000
PhotoStitch 3.1.10
Picasa 3 3.1
PowerDVD 7.0
QuickTime 7.4.5.67
RLPrintPlugin 1.0.3
RandMap 70.0.170.000
RealPlayer
RemoteCapture 2.7.2 2.7.2
Rhapsody
Rhapsody Player Engine 1.0.604
Roxio Creator Audio 3.3.0
Roxio Creator Copy 3.3.0
Roxio Creator DE 3.3.0
Roxio Creator Data 3.3.0
Roxio Creator Tools 3.3.0
Roxio Drag-to-Disc 9.0
Roxio Express Labeler 2.1.0
Roxio Update Manager 3.0.0
SMART Board Drivers 10.0.124.0
SMART Essentials for Educators 1.1.9.0
SanDisk ImageMate Reader/Writer
Scan 8.1.0.0
ScannerCopy 8.0.0.0
Security Update for Windows Media Player (KB911564)
Security Update for Windows Media Player 10 (KB911565)
Security Update for Windows Media Player 10 (KB917734)
Security Update for Windows Media Player 10 (KB936782)
Security Update for Windows Media Player 6.4 (KB925398)
Security Update for Windows Media Player 9 (KB917734)
Security Update for Windows XP (KB883939) 1
Security Update for Windows XP (KB890046) 1
Security Update for Windows XP (KB893066) 2
Security Update for Windows XP (KB893756) 1
Security Update for Windows XP (KB896358) 1
Security Update for Windows XP (KB896422) 1
Security Update for Windows XP (KB896423) 1
Security Update for Windows XP (KB896424) 1
Security Update for Windows XP (KB896428) 1
Security Update for Windows XP (KB896688) 1
Security Update for Windows XP (KB899587) 1
Security Update for Windows XP (KB899588) 1
Security Update for Windows XP (KB899589) 1
Security Update for Windows XP (KB899591) 1
Security Update for Windows XP (KB900725) 1
Security Update for Windows XP (KB901017) 1
Security Update for Windows XP (KB901214) 1
Security Update for Windows XP (KB902400) 1
Security Update for Windows XP (KB903235) 1
Security Update for Windows XP (KB904706) 2
Security Update for Windows XP (KB905414) 1
Security Update for Windows XP (KB905749) 1
Security Update for Windows XP (KB905915) 1
Security Update for Windows XP (KB908519) 1
Security Update for Windows XP (KB911562) 1
Security Update for Windows XP (KB911567) 1
Security Update for Windows XP (KB911927) 1
Security Update for Windows XP (KB912812) 1
Security Update for Windows XP (KB912919) 1
Security Update for Windows XP (KB913446) 1
Security Update for Windows XP (KB913580) 1
Security Update for Windows XP (KB914388) 1
Security Update for Windows XP (KB914389) 1
Security Update for Windows XP (KB916281) 1
Security Update for Windows XP (KB917159) 1
Security Update for Windows XP (KB917344) 1
Security Update for Windows XP (KB917422) 1
Security Update for Windows XP (KB917953) 1
Security Update for Windows XP (KB918118) 1
Security Update for Windows XP (KB918439) 1
Security Update for Windows XP (KB918899) 1
Security Update for Windows XP (KB919007) 1
Security Update for Windows XP (KB920213) 1
Security Update for Windows XP (KB920214) 1
Security Update for Windows XP (KB920670) 1
Security Update for Windows XP (KB920683) 1
Security Update for Windows XP (KB920685) 1
Security Update for Windows XP (KB921398) 1
Security Update for Windows XP (KB921883) 1
Security Update for Windows XP (KB922616) 1
Security Update for Windows XP (KB922760) 1
Security Update for Windows XP (KB922819) 1
Security Update for Windows XP (KB923191) 1
Security Update for Windows XP (KB923414) 1
Security Update for Windows XP (KB923689)
Security Update for Windows XP (KB923694) 1
Security Update for Windows XP (KB923980) 1
Security Update for Windows XP (KB924191) 1
Security Update for Windows XP (KB924270) 1
Security Update for Windows XP (KB924496) 1
Security Update for Windows XP (KB924667) 1
Security Update for Windows XP (KB925454) 1
Security Update for Windows XP (KB925486) 1
Security Update for Windows XP (KB925902) 1
Security Update for Windows XP (KB926255) 1
Security Update for Windows XP (KB926436) 1
Security Update for Windows XP (KB927779) 1
Security Update for Windows XP (KB927802) 1
Security Update for Windows XP (KB928090) 1
Security Update for Windows XP (KB928255) 1
Security Update for Windows XP (KB928843) 1
Security Update for Windows XP (KB929123) 1
Security Update for Windows XP (KB929969) 1
Security Update for Windows XP (KB930178) 1
Security Update for Windows XP (KB931261) 1
Security Update for Windows XP (KB931768) 1
Security Update for Windows XP (KB931784) 1
Security Update for Windows XP (KB932168) 1
Security Update for Windows XP (KB933566) 1
Security Update for Windows XP (KB933729) 1
Security Update for Windows XP (KB935839) 1
Security Update for Windows XP (KB935840) 1
Security Update for Windows XP (KB936021) 1
Security Update for Windows XP (KB937894) 1
Security Update for Windows XP (KB938127) 1
Security Update for Windows XP (KB941202) 1
Security Update for Windows XP (KB941568) 1
Security Update for Windows XP (KB941569)
Security Update for Windows XP (KB941644) 1
Security Update for Windows XP (KB941693) 1
Security Update for Windows XP (KB943055) 1
Security Update for Windows XP (KB943460) 1
Security Update for Windows XP (KB943485) 1
Security Update for Windows XP (KB944338) 1
Security Update for Windows XP (KB944653) 1
Security Update for Windows XP (KB945553) 1
Security Update for Windows XP (KB946026) 1
Security Update for Windows XP (KB947864) 1
Security Update for Windows XP (KB948590) 1
Security Update for Windows XP (KB948881) 1
Security Update for Windows XP (KB958644) 1
Security Update for Windows XP (KB960714) 1
Senteo 1.0.70.1
Silk 4.5.812
Silk 4.5 4.5.834
SkinsHP1 70.0.170.000
SlideShow 70.0.170.000
Snagit 9.1 9.1.0.206
SoftChalk LessonBuilder3
SolutionCenter 70.0.170.000
Sonic Activation Module 1.0
Sonic_PrimoSDK 70.0.170.000
SoundMAX 5.10.01.5491
SpamBayes 1.0.4 1.0.4
Spybot - Search & Destroy 1.5.2
StuffIt Expander 6.0
Symantec Ghost Console Client 110.01.1533
Symantec Technical Support Web Controls 3.5.3
Taskbar Shuffle version 2.5 2.5
The Core Media Player 4.0
Unlock Administrator v 2.00
Update for Windows XP (KB894391) 1
Update for Windows XP (KB896727) 1
Update for Windows XP (KB898461) 1
Update for Windows XP (KB900485) 2
Update for Windows XP (KB908531) 2
Update for Windows XP (KB910437) 1
Update for Windows XP (KB911280) 2
Update for Windows XP (KB916595) 1
Update for Windows XP (KB920872) 1
Update for Windows XP (KB922582) 1
Update for Windows XP (KB927891) 3
Update for Windows XP (KB929338) 1
Update for Windows XP (KB930916) 1
Update for Windows XP (KB931836) 1
Update for Windows XP (KB936357) 1
Update for Windows XP (KB938828) 1
Update for Windows XP (KB942763) 1
VobSub v2.23 (Remove Only)
WebFldrs XP 9.50.7523
WebReg 70.0.170.000
Winamp 5.53
Windows Driver Package - Hewlett-Packard Image (03/27/2007 8.3.0.0) 03/27/2007 8.3.0.0
Windows Genuine Advantage Notifications (KB905474) 1.7.0018.7
Windows Genuine Advantage Validation Tool (KB892130) 1.7.0069.2
Windows Genuine Advantage Validation Tool (KB892130)
Windows Installer 3.1 (KB893803) 3.1
Windows Media Format 11 runtime
Windows Media Format 11 runtime
Windows Media Player 11
Windows Media Player 11
Windows Server 2003 Administration Tools Pack 5.2.3790
Windows XP Hotfix - KB867282 20050127.090417
Windows XP Hotfix - KB873333 20050114.005213
Windows XP Hotfix - KB873339 20041117.092459
Windows XP Hotfix - KB885250 20050118.202711
Windows XP Hotfix - KB885835 20041027.181713
Windows XP Hotfix - KB885836 20041028.173203
Windows XP Hotfix - KB886185 20041021.090540
Windows XP Hotfix - KB887472 20041014.162858
Windows XP Hotfix - KB887742 20041103.095002
Windows XP Hotfix - KB887816 20041015.144805
Windows XP Hotfix - KB888113 20041116.131036
Windows XP Hotfix - KB888302 20041207.111426
Windows XP Hotfix - KB890047 20041221.124506
Windows XP Hotfix - KB890175 20041201.233338
Windows XP Hotfix - KB890859 1
Windows XP Hotfix - KB890923 1
Windows XP Hotfix - KB891781 20050110.165439
Windows XP Hotfix - KB893086 1
cp_OnlineProjectsConfig 70.0.170.000
cp_PosterPrintConfig 70.0.170.000
eSupportQFolder 1.00.0000
hpG4000 8.3.0.0
hpg4000QFolder 1.00.0000
iTunes 7.6.1.9
muvee Plugin 1.0 1.01.100

Reno, thanks. I'm looking at your suggestions now.

Thanks much,

-Matt- :-)


Report •

#6
April 1, 2009 at 22:40:28
Thanks everyone for your help.

I wasn't able to get the set start point code to work correctly but I decided to take Reno's advice and place the results of each computer's inventory in its own text file.

Additionally, I placed these temp files inside of a temp directory so I could simply use the RD /S command to delete the entire directory and temporary contents when I was finished.

Below is the completed inventorying script.

Thanks again for your help Reno,

---------------------------------START OF SCRIPT ---------------------------

@ECHO OFF

ECHO.

IF EXIST Temp RD /S /Q Temp

MD Temp

IF EXIST temp.txt DEL temp.txt

SET /P CLEAR_RESULTS=Clear Results.txt before starting new search? (y/n)

IF NOT %CLEAR_RESULTS%==n IF EXIST Results.txt DEL /Q /F Results.txt

SET /P CLEAR_LOG=Clear Log.txt before starting new search? (y/n)

IF NOT %CLEAR_LOG%==n IF EXIST Log.txt DEL /Q /F Log.txt

ECHO.

ECHO Please specify a software title to filter by (partial title names OK) or,
ECHO if none, please press the Enter key on your computer keyboard:

ECHO.

SET /P FILTER=

ECHO.

IF [%FILTER%]==[] GOTO UNFILTERED
IF NOT [%FILTER%]==[] GOTO FILTERED

PAUSE

EXIT

:UNFILTERED

CLS

ECHO.

ECHO Performing a software inventory on these machines
ECHO With no filter in place...

ECHO.

SETLOCAL
SET key=
FOR /F "Tokens=*" %%a IN ('type PCs.txt') DO SET line=%%a&call :PARSE
ENDLOCAL
GOTO END

:PARSE
::STRIP COMMAND CONTROL CODES
SET work=%line:"=%
SET work=%work::=%
SET work=%work:(=%
SET work=%work:)=%
SET work=%work:^&=%
SET work=%work:^|=%
SET work=%work:^>=%
SET work=%work:^<=%
SET work=%work:^%=%
SET work=%work:^!=%
SET work=%work:^;=%

::SAVE THE KEY
IF {%work:~0,1%}=={[} set key=%line%&goto :EOF
SET dw=%work:dword=%
IF "%dw%" EQU "%work%" goto :EOF

SET filename=%line%
SET substring=%filename:~33,30%
SET temp=%substring%
SET _string=%temp%
SET _endbit=%_string:*?=%
CALL SET _semiresult=%%_string:%_endbit%=%%
SET _result=%_semiresult:?=%

SET COMPUTERNAME=%line%

ECHO.

ECHO Checking to see if %COMPUTERNAME% is online...

PING -n 2 -w 500 %COMPUTERNAME% | FIND "Reply" > nul

IF %ERRORLEVEL%==0 GOTO STARTSCRIPT
IF %ERRORLEVEL%==1 GOTO NOREPLY

EXIT

:STARTSCRIPT

ECHO.

ECHO %COMPUTERNAME%:>>Results.txt

ECHO.>>Results.txt

FOR /F "TOKENS=* DELIMS= " %%b IN ('PSINFO \\%COMPUTERNAME% -s') DO ECHO %%b>>Results.txt

ECHO.>>Results.txt

EXIT /B

:FILTERED

CLS

ECHO.

ECHO Performing a software inventory on these machines
ECHO With the filter in place: %FILTER%

ECHO.

SETLOCAL
SET key=
FOR /F "Tokens=*" %%a IN ('type PCs.txt') DO SET line=%%a&call :PARSE
ENDLOCAL
GOTO END

:PARSE
::STRIP COMMAND CONTROL CODES
SET work=%line:"=%
SET work=%work::=%
SET work=%work:(=%
SET work=%work:)=%
SET work=%work:^&=%
SET work=%work:^|=%
SET work=%work:^>=%
SET work=%work:^<=%
SET work=%work:^%=%
SET work=%work:^!=%
SET work=%work:^;=%

::SAVE THE KEY
IF {%work:~0,1%}=={[} set key=%line%&goto :EOF
SET dw=%work:dword=%
IF "%dw%" EQU "%work%" goto :EOF

SET filename=%line%
SET substring=%filename:~33,30%
SET temp=%substring%
SET _string=%temp%
SET _endbit=%_string:*?=%
CALL SET _semiresult=%%_string:%_endbit%=%%
SET _result=%_semiresult:?=%

SET COMPUTERNAME=%line%

ECHO.

ECHO Checking to see if %COMPUTERNAME% is online...

PING -n 2 -w 500 %COMPUTERNAME% | FIND "Reply" > nul

IF %ERRORLEVEL%==0 GOTO STARTSCRIPT
IF %ERRORLEVEL%==1 GOTO NOREPLY

EXIT

:STARTSCRIPT

ECHO.

ECHO.>>Temp\%COMPUTERNAME%.txt
FOR /F "TOKENS=* DELIMS= " %%b IN ('PSINFO \\%COMPUTERNAME% -s') DO ECHO %%b>>Temp\%COMPUTERNAME%.txt

ECHO %COMPUTERNAME%:>>Results.txt

FOR /F "TOKENS=* DELIMS= " %%b IN ('FINDSTR /I "%FILTER%" Temp\%COMPUTERNAME%.txt') DO (

ECHO %%b>>Results.txt

)

ECHO.>>Results.txt

EXIT /B

:END

IF EXIST Temp RD /S /Q Temp

START Results.txt

EXIT

:NOREPLY

ECHO No Response From %COMPUTERNAME%>>Log.txt

-----------------------------------END OF SCRIPT -----------------------------

-Matt- :-)


Report •

#7
April 1, 2009 at 23:43:50
that's a very long script.

Quote From Mattdew:
I wasn't able to get the set start point code to work correctly

the code

set n=
for /f "tokens=1* delims=[]" %%a in ('type temp.txt^|find/n "System information for \\xxx") do set/a n=%%a

::since your temp.txt is always seperated by empty line between each PC
if not defined n goto:breakloop
for /f "skip=%n% tokens=1* delims=]" %%a in ('type temp.txt^|find/n /v "") do (
if "%%b"=="" goto:breakloop
echo %%b
)
:breakloop

using the code for loop with find/v/n, the drawback is you will lose any character of ] (closing square bracket) in your textfile.

IMO, putting each pc into each textfile is faster. and you can do various thing with it. eg.
1. find pc with the name containing "mat" with "office" installed
find/i "office" .\temp\*mat*.txt
2. find pc with unactivated xp
find/i "Activation status: Error" .\temp\*.txt
3. it also prevent duplicate entry. running psinfo each time will update the existing txt without requery all the network.
4. check when matt pc query is last updated
dir/tw .\temp\matt.txt
5. select how many xp update installed on matt pc
type .\temp\matt.txt|find/c /i "XP (KB"
6. etc etc

good luck.


Report •

#8
April 2, 2009 at 07:11:03
Thanks Reno,

-Matt- :-)


Report •


Ask Question