for process in p.Win32_Process(): print(f"{process.ProcessId:<10} {process.Name}") x = "taskmgr.exe" if str(x) in process.Name: