I'm having difficulty returning values from the 'psutil' library, I need to create a script that finds a service and returns me whether it is running or not, however the service name changes according to the example user's machine : Machine 01 has the service: SRV $ Lokj Machine 02 has the service: SRV $ Kujh
And so on ...
My difficulty is just to filter the values, I tried to use the command servico.find ('SRV $ *') but the return was this:
AttributeError: 'list' object has no attribute 'find'
Code:
import psutil
x = 0
s = list(psutil.win_service_iter())
print (s.find('SRV$*'))