Wmic软件无法正确提取

时间:2019-07-09 10:35:27

标签: batch-file

我批量运行一个脚本,以从wmic中提取CSV报告的软件列表。我有一些关于提取精度的问题。某些版本的脚本输出和同一系统的控制面板中的版本不同。

我也尝试过powershell,但是结果也不准确

@Echo Off
REM ===========START SCRIPT PER REPORT CONFIG HW E SW MACCHINE GxP=======================================================
REM Creato da Pietro Ottati il 29/09/2018 Versione 0.4
REM Filename=Config_HW_SW_0.4
REM ===========DESCRIZIONE VARIABILI=====================================================================================
REM host=Nome del PC e/o del server
REM Dpath=Folder di destinazione dei file di output
REM lst=imposta l'output in modalità lista 
REM tbl=imposta l'output in forma tabulare
REM ===========DICHIARAZIONE VARIABILI===================================================================================
set host=%COMPUTERNAME%
set Dpath=%userprofile%\Desktop\
set lst=/format:list
set tbl=/format:table
set csv=/format:csv
REM ===========GENERAZIONE HWCONFIG ======================================================================================
wmic /output:'%Dpath%HW_%host%.csv' csproduct get Name,Vendor,IdentifyingNumber %lst%
wmic /append:'%Dpath%HW_%host%.csv' cpu get Name,SystemName %lst%
wmic /append:'%Dpath%HW_%host%.csv' computersystem get TotalPhysicalMemory %lst%
wmic /append:'%Dpath%HW_%host%.csv' volume get Name,Capacity %csv%
wmic /append:'%Dpath%HW_%host%.csv' nic get Name,PhysicalAdapter %csv%

REM ===========GENERAZIONE OS CONFIG ======================================================================================
wmic /output:'%Dpath%OS_%host%.csv' os get CSName %lst%
wmic /append:'%Dpath%OS_%host%.csv' os get Caption %lst%
wmic /append:'%Dpath%OS_%host%.csv' os get Description %lst%
wmic /append:'%Dpath%OS_%host%.csv' os get Name %lst%
wmic /append:'%Dpath%OS_%host%.csv' os get CSDVersion %lst%
wmic /append:'%Dpath%OS_%host%.csv' os get BuildNumber %lst%
wmic /append:'%Dpath%OS_%host%.csv' os get OSArchitecture %lst%
wmic /append:'%Dpath%OS_%host%.csv' os get Version %lst%
wmic /append:'%Dpath%OS_%host%.csv' timezone get Description %lst%

REM ===========GENERAZIONE SW CONFIG ======================================================================================
wmic /output:'%Dpath%SW_tbl_%host%.csv' product get Name,Version,Vendor %tbl%
wmic /output:'%Dpath%SW_csv_%host%.csv' product get Name,Version,Vendor %csv%

REM ===========END SCRIPT PER REPORT CONFIG HW E SW MACCHINE GxP==========================================================

我将找到一种方法来获取每次准确的软件列表和相关版本,以便通过CSV和控制面板进行仔细检查。

0 个答案:

没有答案