make python script run like a service or agent in Windows -
i have written python script collect wmi data machine.
i want script run 24*7 , wmi data.
how can script execute 24/7, such turning agent or service in windows. need loop never ends in program, or can done having code re executed multiple times?
thanks
here basic script.
import os import time import wmi c = wmi.wmi() def systeminfo1(): for cpu in c.win32_processor(): print('cpu_useper', cpu.loadpercentage) def systeminfo(): for mem in c.win32_perfformatteddata_perfos_memory(): print('memused_perc', mem.percentcommittedbytesinuse) while true: systeminfo() time.sleep(5) systeminfo1() time.sleep(30)
you can use multi threading if want want scan multiple machines in domain.
i have developed script runs continuously , helps me capture os details of around 10000 machines in 1 day , installed product details in 7 days.
do let me know if need help.
Comments
Post a Comment