-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsi_instaled.py
36 lines (32 loc) · 1021 Bytes
/
msi_instaled.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/python
# -*- coding: utf-8 -*-
try:
import win32com.client
except ImportError:
pass
def get_odbc_version():
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2")
colItems = objSWbemServices.ExecQuery("Select * from Win32_Product")
bc = {}
for objItem in colItems:
if objItem.Name == 'psqlODBC':
bc["Name"] = objItem.Name
bc["version"] = str(objItem.Version)
bc["Package Cache"] = str(objItem.PackageCache)
a = objItem.Version.split('.')
bc["major"] = int(a[0])
bc['minor'] = int(a[1])
bc['release'] = int(a[2])
break
if bc == {}:
bc["Name"] = 'None'
bc["version"] = '0.000.000'
bc["Package Cache"] = 'None'
bc["major"] = 0
bc['minor'] = 0
bc['release'] = 0
return bc
if __name__ == '__main__':
pass