2014年2月19日 星期三

[記事] List the details of all the installed software in windows

屬於阿宅世界的技術文章,想看的再點開,切莫自誤 !




Since that we can list the details of all the installed packages in linux , cloud we do the same thing in windows ?
The answer is positive

As administrator,
shell> wmic product list full

will get result like :

Description=AAAAAAAAAA
IdentifyingNumber={BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB}
InstallDate=YYYYMMDD
InstallLocation=
InstallState=5
Name=CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
PackageCache=C:\<CACHE>\<DIR>\<FILE>
SKUNumber=
Vendor=Microsoft Corporation
Version=V.V.VVVVV

if u have error like
Node - AUSDC01
ERROR:
Code = 0x80041010
Description = Invalid class
Facility = WMI

Try to install the optional windows component "WMI Windows Installer Provider" in the Management and Monitoring Tools" group.

p.s try shell> wmic /? for more information

Due to known reason, some applications won't show up in the list.
We may try the get the list from registry instead.

Create a batch file (.bat) with following commands and save and execute
@echo off
setlocal enabledelayedexpansion
c:
cd\
cd %userprofile%\desktop

if exist temp1.txt erase temp1.txt
if exist temp2.txt erase temp2.txt
if exist softwares.txt erase softwares.txt

copy /y NUL softwares.txt >NUL
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall > temp1.txt
for /f %%k in (temp1.txt) do (
  reg query %%k > temp2.txt && (                     
    for /f "skip=2 tokens=3* delims= " %%i in ('find "DisplayName" temp2.txt ^| find /V "ParentDisplayName"') do (
      >> softwares.txt 
  
    for /f "skip=2 tokens=3* delims= " %%i in ('find "DisplayVersion" temp2.txt') do echo %%i %%j >> softwares.txt  
  ) || (
    echo registry :  %%k
  ) 
) 

and the data in softwares.txt will look like :
...
Microsoft .NET Framework 4 Client Profile,4.0.30319
Update for Microsoft .NET Framework 4 Client Profile (KB2468871),1
Update for Microsoft .NET Framework 4 Client Profile (KB2533523),1
Update for Microsoft .NET Framework 4 Client Profile (KB2600217),1
...

U may add the column u want by urself.

0 意見:

張貼留言