Page 1 of 1

Newbi Help with Batch file

Posted: 10 May 2012 03:49
by millwalll
Hi all,

I am pretty new to batch files and have been given a task by my company where I think having handy batch file would same me a lot of time. I have tried to google for batch files that already acheive this and tried putting my own together hacking different batch files togehter.

What I would like is batch file that will provide me with the following information:

Username
Make/Model of computer
CPU
RAM
Disk Size
OS version
All software installed with version
Serial number of machine
Serial number of any mointors attached to machine

Providing all this would be amazing but as much info as I can get would also help lots.

So far I have this

Code: Select all

echo List of softwares > software_list.txt
echo ================= >>software_list.txt

echo Username = %username% >>software_list.txt
wmic bios get serialnumber >>software_list.txt

reg export HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall temp1.txt
find "DisplayName" temp1.txt| find /V "ParentDisplayName" > temp2.txt
for /f "tokens=2,3 delims==" %%a in (temp2.txt) do (echo %%a >> software_list.txt)

del temp1.txt temp2.txt


Any help or advice would be great I would not mind getting rid of all the update info.

thanks in advance!

Re: Newbi Help with Batch file

Posted: 10 May 2012 05:25
by foxidrive
Google this and look in the help for command line options. Maybe it will provide what you want.

System Information for Windows
Freeware Version
Gabriel Topala

Re: Newbi Help with Batch file

Posted: 10 May 2012 05:37
by Squashman
Open up a cmd prompt and type: systeminfo
That will get you a few of the things you want.

Re: Newbi Help with Batch file

Posted: 10 May 2012 06:24
by millwalll
ok thanks will look into it

Re: Newbi Help with Batch file

Posted: 10 May 2012 06:36
by abc0502
Here is a code but i couldn't get the serial numbers, And the hdd size i get it two numbers it's always the first
This will get the info on the screen and log it to a file in ur desktop

Code: Select all

@ECHO OFF
CLS
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a" )

Set "log=%userprofile%\desktop\installedprogs.txt"
if exist "%log%" del /q %log%
CALL :C 0a "=====================================" &echo:
CALL :C e0 "Gathering Information ...please wait " &echo:
CALL :C 0a "=====================================" &echo:

CALL :C 0c "User Name " &call :C 0f "%username%" &echo:
echo. User Name = %username% >> "%log%"
echo. >> "%log%"
echo.

CALL :C 0c "Make-Model of Computer" &echo:
echo.Make-Model of Computer = >> "%log%"
For /f "tokens=*" %%a in ('set ^|find "PROCESSOR"') DO CALL :C 0f "%%a"&echo: &echo.%%a >>%log%
echo. >>"%log%"
echo.

For /f "tokens=10" %%b in ('wmic cpu list brief') do set cpu=%%b
CALL :C 0c "CPU Speed " &call :C 0f "%cpu%" &echo:
echo.CPU Speed = %cpu% >> "%log%"
echo. >> "%log%"
echo.

For /f "tokens=2 delims==" %%c in ('wmic COMPUTERSYSTEM list full ^|find "TotalPhysicalMemory"') do set mem=%%c
CALL :C 0c "Memory Total Size " &call :C 0f "%mem%" &echo:
echo.Memory Total Size = %mem% >> "%log%"
echo. >> "%log%"
echo.

For /f "Tokens=*" %%d in ('wmic DISKDRIVE get size') do (
CALL :C 0c "HDD Size  " &echo:
CALL :C 0f "%%d"
echo.HDD Size = %%d >> "%log%"
)
echo. >> "%log%"
echo.

For /f "tokens=*" %%e in ('ver ^|find "Microsoft"') do set ver=%%e
CALL :C 0c "OS Version " &call :C 0f "%ver%"
echo.OS Version = %ver% >> "%log%"
echo. >> "%log%"
echo.
echo.

For /f "tokens=2 delims==" %%f in ('wmic baseboard list full ^|findstr "SerialNumber"') do set serial=%%f
CALL :C 0c "MotherBoard Serial Number " &call :C 0f "%serial%"
echo.MotherBoard Serial Number = %serial% >> "%log%"
echo. >> "%log%"
echo.
echo.
echo.
Call :C 0D "Gathering Information Completed."&echo:
Call :C 0e "All Data has been loged to your desktop"&echo:
Pause >nul

:C
echo off
cd %temp%
<nul set /p "=%DEL%" >> "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
goto :eof

:eof
Exit
:: http://www.dostips.com/forum/

Re: Newbi Help with Batch file

Posted: 10 May 2012 19:21
by Ed Dyreen
'
abc0502 wrote:Here is a code but i couldn't get the serial numbers
I couldn't get the wmic baseboard serialNumber either,
would be pleased to find out how to uniquely identify a system other than by using it's getMAC address.

Re: Newbi Help with Batch file

Posted: 11 May 2012 09:42
by shanmukhateja
open cmd
type sysinfo32>c:\log.txt
open c:\ n check if all the details r fit in or not
hope dis will help :D

Re: Newbi Help with Batch file

Posted: 11 May 2012 10:02
by foxidrive
shanmukhateja wrote:open cmd
type sysinfo32>c:\log.txt


On my XP machine it doesn't seem to be on the path so I needed to use this - and also add the /report switch,

Code: Select all

"c:\Program Files\Common Files\Microsoft Shared\MSInfo\msinfo32.exe" /report log.txt



It can take a while too.

Re: Newbi Help with Batch file

Posted: 11 May 2012 17:25
by abc0502
Ed Dyreen wrote:'
abc0502 wrote:Here is a code but i couldn't get the serial numbers
I couldn't get the wmic baseboard serialNumber either,
would be pleased to find out how to uniquely identify a system other than by using it's getMAC address.


There could be away to identify a pc we can use more than one command output to identify a system like
taking the Product from BASEBOARD, and Version from BIOS, and UUID from CSPRODUCT

if the whole three match that gave a positive ID and if not that gave a false ID
Also we can take more than this three so we can narrow Margin of error.

Re: Newbi Help with Batch file

Posted: 12 May 2012 16:39
by Ed Dyreen
abc0502 wrote:There could be away to identify a pc we can use more than one command output to identify a system like
taking the Product from BASEBOARD, and Version from BIOS, and UUID from CSPRODUCT
'
We have several mainboards that are the same product and use the same bios versions,
also for some reason UUID is always 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF' ??
getMAC will work perfectly unless the pc lacks a NIC.

But I won't deviate this topic any further, 8)

Re: Newbi Help with Batch file

Posted: 14 May 2012 01:52
by miskox
Maybe this could be useful to you:

BGinfo

http://technet.microsoft.com/en-us/sysi ... s/bb897557

Saso