I have two windows services "abc" and "xyz". I want to find out parent process id of each services. But every time parent process id is same for both services. what I have done so far..
service1 = psutil.win_service_get('abc')
service2 = psutil.win_service_get('xyz')
s_pid1 = service1.pid()
s_pid2 = service2.pid()
p1 = psutil.Process(s_pid1)
p2 = psutil.Process(s_pid2)
p_pid1 = p1.ppid()
p_pid2 = p2.ppid()
parent_proc1 = p1.parent()
parent_proc2 = p2.parent()
print(p_pid1, parent_proc1, p_pid2, parent_proc2)
every time it's printing like:
636 psutil.Process(pid=636, name='services.exe', started='09:28:27') 636 psutil.Process(pid=636, name='services.exe', started='09:28:27')
I can't find out what's wrong. Any help will be appreciated.