There are several ways to achieve it.
You could use WMI to query the Win32_Product class:
You also could use Sysinternals’ PsInfo.
You could use some inventory tool (most of them use WMI internally) such as OCS Inventory NG or Spiceworks, among others. These kind of tool is usually the easier way, as they can scan your network and get the software inventory automatically.