analitics

Pages

Saturday, May 25, 2019

Python 3.7.3 : Using the win32com - part 004.

This is a source code I created a few days ago.
import win32com.client
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2")
colItems = objSWbemServices.ExecQuery("Select * from Win32_ProgIDSpecification")
for objItem in colItems:
    print ("Caption: ", objItem.Caption)
    print ("Check ID: ", objItem.CheckID)
    print ("Check Mode: ", objItem.CheckMode)
    print ("Description: ", objItem.Description)
    print ("Name: ", objItem.Name)
    print ("Parent: ", objItem.Parent)
    print ("ProgID: ", objItem.ProgID)
    print ("Software Element ID: ", objItem.SoftwareElementID)
    print ("Software Element State: ", objItem.SoftwareElementState)
    print ("Target Operating System: ", objItem.TargetOperatingSystem)
    print ("Version: ", objItem.Version)
This script uses the win32com python module to show us info about Win32_ProgIDSpecification.
The result is strange and shows like this:
...
Version:  None
Caption:  Addin Class
...
See the full documentation at this link.