{"id":13565934,"url":"https://github.com/sindresorhus/tasklist","last_synced_at":"2025-04-09T15:05:36.809Z","repository":{"id":32964608,"uuid":"36579963","full_name":"sindresorhus/tasklist","owner":"sindresorhus","description":"Wrapper for the Windows `tasklist` command. Returns a list of apps and services with their Process ID (PID) for all tasks running on either a local or a remote computer.","archived":false,"fork":false,"pushed_at":"2021-08-12T12:08:18.000Z","size":34,"stargazers_count":67,"open_issues_count":1,"forks_count":18,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-09T15:05:31.976Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2015-05-30T23:36:58.000Z","updated_at":"2025-02-09T15:50:22.000Z","dependencies_parsed_at":"2022-08-07T19:01:18.912Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/tasklist","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ftasklist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ftasklist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ftasklist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Ftasklist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/tasklist/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055284,"owners_count":21040157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:01:58.190Z","updated_at":"2025-04-09T15:05:36.787Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["JavaScript"],"sub_categories":[],"readme":"# tasklist\n\n\u003e Wrapper for the Windows [`tasklist`](https://technet.microsoft.com/en-us/library/bb491010.aspx) command. Returns a list of apps and services with their Process ID (PID) for all tasks running on either a local or a remote computer.\n\nCleans up and normalizes the data.\n\n## Install\n\n```\n$ npm install tasklist\n```\n\n## Usage\n\n```js\nimport {tasklist} from 'tasklist';\n\nconsole.log(await tasklist());\n/*\n[\n\t{\n\t\timageName: 'taskhostex.exe',\n\t\tpid: 1820,\n\t\tsessionName: 'Console',\n\t\tsessionNumber: 1,\n\t\tmemUsage: 4415488\n\t},\n\t…\n]\n*/\n```\n\n## API\n\nSee the [`tasklist` docs](https://technet.microsoft.com/en-us/library/bb491010.aspx) for more.\n\n### tasklist(options?)\n\nReturns a `Promise\u003cobject[]\u003e` that contains the normalized results of the command output.\n\nExamples for `options` below will use this interface, but you can check `tasklist.stream` below for usage of the stream interface.\n\n### tasklistStream(options?)\n\nReturns a `stream.Readable` that returns the resulting lines, normalized, one-by-one.\n\nOptions are the same as the Promise interface.\n\n```js\nimport {tasklistStream} from 'tasklist';\n\ntasklistStream({verbose: true}).pipe(process.stdout);\n/*\n{\n    imageName: 'taskhostex.exe',\n    pid: 1820,\n    sessionName: 'Console',\n    sessionNumber: 1,\n    memUsage: 4415488,\n    status: 'Running',\n    username: 'SINDRESORHU3930\\\\sindre'\n    cpuTime: 0,\n    windowTitle: 'Task Host Window'\n}\n…\n*/\n```\n\n#### options\n\nType: `object`\n\n**Warning**\n- The `system`, `username`, `password` options must be specified together.\n- The `modules` and `services` options can't be specified if verbose is set to `true`.\n- The `modules` and `services` options can't be specified at the same time.\n- When `system`, `username`, `password` options are specified, the filter option can't have `windowtitle` and `status` as the parameter.\n\n##### verbose\n\nType: `boolean`\\\nDefault: `false`\n\nReturn verbose results.\n\nWithout the `verbose` and `apps` option, `tasklist` returns tasks with the following properties:\n\n- `imageName` (Type: `string`)\n- `pid` (Type: `number`)\n- `sessionName` (Type: `string`)\n- `sessionNumber` (Type: `number`)\n- `memUsage` in bytes (Type: `number`)\n\nWith the `verbose` option set to `true` but the `apps` option still set to `false`, it additionally returns the following properties:\n\n- `status` (Type: `string`): One of `Running`, `Suspended`, `Not Responding`, or `Unknown`\n- `username` (Type: `string`)\n- `cpuTime` in seconds (Type: `number`)\n- `windowTitle` (Type: `string`)\n\n**Note:** It's not guaranteed that the `username` and `windowTitle` properties are returned with proper values. If they are *not available*, `'N/A'` may be returned on English systems. In contrast, `'Nicht zutreffend'` may be returned on German systems, for example.\n\n**Verbose example:**\n\n```js\nimport {tasklist} from 'tasklist';\n\nconsole.log(await tasklist({verbose: true}));\n/*\n[\n\t{\n\t\timageName: 'taskhostex.exe',\n        pid: 1820,\n        sessionName: 'Console',\n        sessionNumber: 1,\n        memUsage: 4415488,\n        status: 'Running',\n        username: 'SINDRESORHU3930\\\\sindre'\n        cpuTime: 0,\n        windowTitle: 'Task Host Window'\n\t},\n\t…\n]\n*/\n```\n\n**Warning:** Using the `verbose` option may have a considerable performance impact (See: [#6](https://github.com/sindresorhus/tasklist/issues/6)).\n\n##### system\n\nType: `string`\n\nName or IP address of a remote computer (don't use backslashes). The default is the local computer.\n\n##### username\n\nType: `string`\\\nExample: `'SINDRESORHU3930\\\\sindre'`\n\nUser specified by `User` or `Domain\\User`. The default is the permissions of the current logged on user on the computer issuing the command.\n\n##### password\n\nType: `string`\n\nPassword of the user account for the specified `username`.\n\n##### filter\n\nType: `string[]`\n\nSpecify the types of processes to include or exclude. [More info.](https://technet.microsoft.com/en-us/library/bb491010.aspx)\n\n##### apps\n\nType: `boolean`\n\nDisplays store apps.\nWithout the `verbose` option, the command returns the following data:\n- `imageName` (Type: `string`)\n- `pid` (Type: `number`)\n- `memUsage` in bytes (Type: `number`)\n- `packageName` (Type: `string`)\n\n```js\nimport {tasklist} from 'tasklist';\n\nconsole.log(await tasklist({apps: true}));\n/*\n[\n\t{\n\t\timageName: 'SearchUI.exe (CortanaUI)',\n        pid: 1820,\n        memUsage: 4415488,\n        packageName: 'Microsoft.Windows.Cortana'\n\t},\n\t…\n]\n*/\n```\n\nWith the `verbose` option set to `true`, the command additionally returns the following data:\n- `sessionName` (Type: `string`)\n- `sessionNumber` (Type: `number`)\n- `status` (Type: `string`): One of `Running`, `Suspended`, `Not Responding`, or `Unknown`\n- `username` (Type: `string`)\n- `cpuTime` in seconds (Type: `number`)\n- `windowTitle` (Type: `string`)\n\n**Note:** It's not guaranteed that the `username` and `windowTitle` properties are returned with proper values. If they are *not available*, `'N/A'` may be returned on English systems. In contrast, `'Nicht zutreffend'` may be returned on German systems, for example.\n\n**Verbose example:**\n\n```js\nimport {tasklist} from 'tasklist';\n\nconsole.log(await tasklist({apps: true, verbose: true}));\n/*\n[\n\t{\n\t\timageName: 'SearchUI.exe (CortanaUI)',\n        pid: 1820,\n        sessionName: 'Console',\n        sessionNumber: 1,\n        memUsage: 4415488,\n        status: 'Running',\n        username: 'SINDRESORHU3930\\\\sindre'\n        cpuTime: 0,\n        windowTitle: 'N/A',\n        packageName: 'Microsoft.Windows.Cortana'\n\t},\n\t…\n]\n*/\n```\n\n##### modules\n\nType: `string`\n\nList all tasks using the given DLL module name. If an empty string is given, it will list all tasks with the used DLL modules.\n\n**Note:** You can't use the `verbose` option with this option set.\n\n```js\nimport {tasklist} from 'tasklist';\n\nconsole.log(await tasklist({modules: 'wmiutils.dll'}));\n/*\n[{\n\timageName: 'chrome.exe',\n    pid: 1820,\n    modules: ['wmiutils.dll']\n}, …]\n*/\n```\n\n##### services\n\nType: `boolean`\n\nDisplays services hosted in each process.\n**Note:** You can't use the `verbose` option with this option set.\n\n```js\nimport {tasklist} from 'tasklist';\n\nconsole.log(await tasklist({services: true}));\n/*\n[{\n\timageName: 'lsass.exe',\n    pid: 856,\n    services: ['KeyIso', 'SamSs', 'VaultSvc']\n}, …]\n*/\n```\n\n## Related\n\n- [taskkill](https://github.com/sindresorhus/taskkill) - Wrapper for the Windows `taskkill` command\n\n## Maintainers\n\n- [Sindre Sorhus](https://sindresorhus.com)\n- [Mark Tiedemann](https://marksweb.site)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Ftasklist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Ftasklist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Ftasklist/lists"}