90 lines
4.5 KiB
Batchfile
90 lines
4.5 KiB
Batchfile
|
@echo off
|
|||
|
SETLOCAL EnableDelayedExpansion
|
|||
|
|
|||
|
set ver=0.1beta
|
|||
|
title WMIC Summary v%ver%
|
|||
|
set cols=80
|
|||
|
mode con cols=%cols% lines=40
|
|||
|
color 0a
|
|||
|
|
|||
|
cls
|
|||
|
echo R<>cup<75>ration des informations mat<61>rielles...
|
|||
|
REM skip saute 1 ligne, tokens=* r<>cup<75>re toute la ligne, /v "^$" supprime les lignes vide
|
|||
|
for /f "skip=1 tokens=*" %%A in ('%WINDIR%\System32\wbem\wmic.exe bios get serialnumber^| findstr /v "^$"') do set hard_sn1=%%A
|
|||
|
for /f "skip=1 tokens=*" %%A in ('%WINDIR%\System32\wbem\wmic.exe baseboard get serialnumber^| findstr /v "^$"') do set hard_sn2=%%A
|
|||
|
set hard_sn_both=0
|
|||
|
if "%hard_sn1%" neq "" if "%hard_sn2%" neq "" set hard_sn_both=1
|
|||
|
for /f "skip=1 tokens=*" %%A in ('%WINDIR%\System32\wbem\wmic.exe computersystem get model^| findstr /v "^$"') do set hard_model=%%A
|
|||
|
for /f "skip=1 tokens=*" %%A in ('%WINDIR%\System32\wbem\wmic.exe computersystem get systemfamily^| findstr /v "^$"') do set hard_family=%%A
|
|||
|
for /f "skip=1 tokens=*" %%A in ('%WINDIR%\System32\wbem\wmic.exe cpu get name ^| findstr /v "^$"') do set hard_cpu=%%A
|
|||
|
for /f "skip=1 tokens=*" %%A in ('%WINDIR%\System32\wbem\wmic.exe computersystem get numberoflogicalprocessors ^| findstr /v "^$"') do set hard_cpunum=%%A
|
|||
|
set hard_cpunum=%hard_cpunum: =%
|
|||
|
for /f "skip=1 tokens=*" %%A in ('%WINDIR%\System32\wbem\wmic.exe os get totalvisiblememorysize ^| findstr /v "^$"') do set ram_total=%%A
|
|||
|
set /a ram_total=%ram_total% / 1024
|
|||
|
REM DISKDRIVE
|
|||
|
set /a "hddnum=1"
|
|||
|
for /f "skip=1 tokens=*" %%A in ('%WINDIR%\System32\wbem\wmic.exe diskdrive get caption ^| findstr /v "^$"') do (
|
|||
|
set hdd!hddnum!name=%%A
|
|||
|
set /a "hddnum+=1"
|
|||
|
)
|
|||
|
set /a "hddnum=1"
|
|||
|
for /f "skip=1 tokens=*" %%A in ('%WINDIR%\System32\wbem\wmic.exe diskdrive get size ^| findstr /v "^$"') do (
|
|||
|
set hdd!hddnum!size=%%A
|
|||
|
set /a "hddnum+=1"
|
|||
|
)
|
|||
|
REM PRINTERS
|
|||
|
for /f "skip=1 tokens=*" %%A in ('%WINDIR%\System32\wbem\wmic.exe printer where "default=True" get name^,portname ^| findstr /v "^$"') do set hard_print=%%A
|
|||
|
echo %hard_print% (Par d<>faut)> %temp%\wmicsum_printers.txt
|
|||
|
for /f "skip=1 tokens=*" %%A in ('%WINDIR%\System32\wbem\wmic.exe printer where "default=False" get name^,portname ^| findstr /v "^$"') do (
|
|||
|
set hard_print=%%A
|
|||
|
echo !hard_print:~0,%cols%!>> %temp%\wmicsum_printers.txt
|
|||
|
)
|
|||
|
echo R<>cup<75>ration des informations syst<73>me...
|
|||
|
for /f "tokens=1 delims=|" %%A in ('%WINDIR%\System32\wbem\wmic.exe os get name ^| findstr Windows') do set os_name=%%A
|
|||
|
for /f "skip=1 tokens=1 delims=|" %%A in ('%WINDIR%\System32\wbem\wmic.exe os get Version ^| findstr .') do set os_version=%%A
|
|||
|
if "%CommonProgramW6432%"=="" (set os_arch=32 bits) else (set os_arch=64 bits)
|
|||
|
for /f "skip=1 tokens=*" %%A in ('%WINDIR%\System32\wbem\wmic.exe computersystem get name ^| findstr /v "^$"') do set hostname=%%A
|
|||
|
for /f "skip=1 tokens=*" %%A in ('%WINDIR%\System32\wbem\wmic.exe computersystem get domain ^| findstr /v "^$"') do set domain=%%A
|
|||
|
|
|||
|
cls
|
|||
|
echo Mat<61>riel
|
|||
|
echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if %hard_sn_both%==1 echo Num<75>ro de s<>rie (Bios) : %hard_sn1% && echo Num<75>ro de s<>rie (Carte m<>re) : %hard_sn2%
|
|||
|
if %hard_sn_both%==0 if "%hard_sn1%" neq "" echo Num<75>ro de s<>rie : %hard_sn1%
|
|||
|
if %hard_sn_both%==0 if "%hard_sn2%" neq "" echo Num<75>ro de s<>rie : %hard_sn2%
|
|||
|
echo Mod<6F>le : %hard_model%
|
|||
|
if "%hard_family%" neq "" echo Famille : %hard_family%
|
|||
|
echo Processeur : %hard_cpu% (x%hard_cpunum%)
|
|||
|
echo M<>moire vive totale : %ram_total% Mo
|
|||
|
REM <20> l'<27>tape d'avant une ligne fantome est g<>n<EFBFBD>r<EFBFBD>e... je compense en diminuant de 1 la valeur de %hddnum%
|
|||
|
set /a "hddnummax=hddnum-1"
|
|||
|
set /a "hddnum=1"
|
|||
|
:hddoutput
|
|||
|
set name=!hdd%hddnum%name!
|
|||
|
set size=!hdd%hddnum%size: =!
|
|||
|
REM set /a size=%size% / ?1024
|
|||
|
REM je ne peux pas utiliser set /a car le nombre que je divise est trop grand pour set ...
|
|||
|
echo Disque %hddnum% : %name% %size:~0,-10% Go
|
|||
|
if %hddnum% EQU %hddnummax% goto hddend
|
|||
|
set /a "hddnum+=1"
|
|||
|
goto hddoutput
|
|||
|
:hddend
|
|||
|
echo.
|
|||
|
echo Syst<73>me
|
|||
|
echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
echo Version : %os_name% %os_version%%os_arch%
|
|||
|
echo Hostname : %hostname%
|
|||
|
echo Domaine : %domain%
|
|||
|
echo.
|
|||
|
echo # Disques logiques locaux
|
|||
|
for /f "skip=1 tokens=*" %%A in ('wmic logicaldisk get VolumeName^,Name^,Description^ ^| findstr /v "^$" ^| findstr /v "r<>seau"') do echo %%A
|
|||
|
echo.
|
|||
|
echo # Disques r<>seaux
|
|||
|
for /f "skip=1 tokens=*" %%A in ('wmic logicaldisk get ProviderName^,Name^,Description^ ^| findstr /v "^$" ^| findstr /v "Disque"') do echo %%A
|
|||
|
echo.
|
|||
|
echo # Imprimantes
|
|||
|
type %temp%\wmicsum_printers.txt
|
|||
|
pause > nul
|
|||
|
|
|||
|
REM suppression des fichiers temporaires avant fermeture
|
|||
|
del /q %temp%\wmicsum_printers.txt
|