前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >第三方工具命令行过滤计划任务,比系统自带的命令要精细

第三方工具命令行过滤计划任务,比系统自带的命令要精细

原创
作者头像
Windows技术交流
修改2023-12-07 15:17:38
3250
修改2023-12-07 15:17:38
举报
文章被收录于专栏:Windows技术交流Windows技术交流

TaskSchedulerView.exe可看的信息,细节很细

#http://www.nirsoft.net/utils/task_scheduler_view.html

#http://www.nirsoft.net/utils/taskschedulerview-x64.zip

1、以WinSAT为例

系统CPU占用高,发现有WinSAT.exe,我记得有个计划任务跟它有关,但想不起是哪个,于是这个命令行工具就派上用场了,马上就帮我找出来是哪个计划任务了(我用字符串"SAT"过滤的)

代码语言:javascript
复制
#http://www.nirsoft.net/utils/task_scheduler_view.html
#http://www.nirsoft.net/utils/taskschedulerview-x64.zip
#TaskSchedulerView.exe /scomma tasks.txt /Columns "Task Name,Status,Hidden,Task Folder,Executable File"

TaskSchedulerView.exe /scomma tasks.txt /Columns "Task Name,Task Folder,Status,Executable File,COM Handler Filename,COM Handler Description,Description,Source"
start-sleep 15
Get-Content tasks.txt| where-object {$_ -match "SAT"}
#做展示格式的处理示例
#Get-Content tasks.txt| where-object {$_ -match "SAT"}|foreach{$_.split(",")}
#Get-Content tasks.txt| where-object {$_ -match "SAT"}|foreach{$_.split(",")[0]}
#Get-Content tasks.txt| where-object {$_ -match "SAT"}|foreach{ ($_ -split ",", 3)[0,1] -join "," }
Get-Content tasks.txt | Where-Object { $_ -match "SAT" } | ForEach-Object { $parts = ($_ -split ",", 3)[0,1]; $parts[1] = $parts[1] + "\"; $parts -join "," }

2、以Diagnos为例

代码语言:javascript
复制
TaskSchedulerView.exe /scomma tasks.txt /Columns "Task Name,Task Folder,Status,Executable File,COM Handler Filename,COM Handler Description,Description,Source"
start-sleep 15
#Get-Content tasks.txt | Where-Object { $_ -match "Diagnos" } | ForEach-Object { ($_ -split ",", 3)[0,1] -join "," }
Get-Content tasks.txt| where-object {$_ -match "Diagnos"}| ForEach-Object { $parts = ($_ -split ",", 3)[0,1]; $parts[1] = $parts[1] + "\"; $parts -join "," }

3、以Application为例

代码语言:javascript
复制
TaskSchedulerView.exe /scomma tasks.txt /Columns "Task Name,Task Folder,Status,Executable File,COM Handler Filename,COM Handler Description,Description,Source"
start-sleep 15
#Get-Content tasks.txt | Where-Object { $_ -match "Application" } | ForEach-Object { ($_ -split ",", 3)[0,1] -join "," }
Get-Content tasks.txt| where-object {$_ -match "Application"}| ForEach-Object { $parts = ($_ -split ",", 3)[0,1]; $parts[1] = $parts[1] + "\"; $parts -join "," }

4、以Disk为例

代码语言:javascript
复制
TaskSchedulerView.exe /scomma tasks.txt /Columns "Task Name,Task Folder,Status,Executable File,COM Handler Filename,COM Handler Description,Description,Source"
start-sleep 15
#Get-Content tasks.txt | Where-Object { $_ -match "Disk" } | ForEach-Object { ($_ -split ",", 3)[0,1] -join "," }
Get-Content tasks.txt| where-object {$_ -match "Disk"}| ForEach-Object { $parts = ($_ -split ",", 3)[0,1]; $parts[1] = $parts[1] + "\"; $parts -join "," }

5、以Experience为例

代码语言:javascript
复制
TaskSchedulerView.exe /scomma tasks.txt /Columns "Task Name,Task Folder,Status,Executable File,COM Handler Filename,COM Handler Description,Description,Source"
start-sleep 15
#Get-Content tasks.txt | Where-Object { $_ -match "Experience" } | ForEach-Object { ($_ -split ",", 3)[0,1] -join "," }
Get-Content tasks.txt| where-object {$_ -match "Experience"}| ForEach-Object { $parts = ($_ -split ",", 3)[0,1]; $parts[1] = $parts[1] + "\"; $parts -join "," }

6、以Defender为例(如果禁用defender,建议安装杀毒防护软件,比如赛门铁克,Symantec Endpoint Protection 14.3 RU3和RU4是支持2008R2的最后2个版本,同时也兼容Server2012~2022

代码语言:javascript
复制
TaskSchedulerView.exe /scomma tasks.txt /Columns "Task Name,Task Folder,Status,Executable File,COM Handler Filename,COM Handler Description,Description,Source"
start-sleep 15
#Get-Content tasks.txt | Where-Object { $_ -match "Defender" } | ForEach-Object { ($_ -split ",", 3)[0,1] -join "," }
Get-Content tasks.txt| where-object {$_ -match "Defender"}| ForEach-Object { $parts = ($_ -split ",", 3)[0,1]; $parts[1] = $parts[1] + "\"; $parts -join "," }

7、以Maintenance为例(这个要非常谨慎!!!

代码语言:javascript
复制
TaskSchedulerView.exe /scomma tasks.txt /Columns "Task Name,Task Folder,Status,Executable File,COM Handler Filename,COM Handler Description,Description,Source"
start-sleep 15
#Get-Content tasks.txt | Where-Object { $_ -match "Maintenance" } | ForEach-Object { ($_ -split ",", 3)[0,1] -join "," }
Get-Content tasks.txt| where-object {$_ -match "Maintenance"}| ForEach-Object { $parts = ($_ -split ",", 3)[0,1]; $parts[1] = $parts[1] + "\"; $parts -join "," }

以上7个关键词的计划任务都列举出来:

代码语言:javascript
复制
TaskSchedulerView.exe /scomma tasks.txt /Columns "Task Name,Task Folder,Status,Executable File,COM Handler Filename,COM Handler Description,Description,Source"
Start-Sleep 15
#Get-Content tasks.txt | Where-Object { $_ -match "WinSAT|Disk|Application|Diagnos|Experience|Defender|Maintenance" } | ForEach-Object { ($_ -split ",", 3)[0,1] -join "," }
Get-Content tasks.txt | Where-Object { $_ -match "WinSAT|Disk|Application|Diagnos|Experience|Defender|Maintenance" }| ForEach-Object { $parts = ($_ -split ",", 3)[0,1]; $parts[1] = $parts[1] + "\"; $parts -join "," }

TaskSchedulerView.exe /scomma tasks.txt /Columns "Task Name,Task Folder,Status,Executable File,COM Handler Filename,COM Handler Description,Description,Source"

start-sleep 15

Get-Content tasks.txt | Where-Object { $_ -match "CreateObjectTask"}

这些Windows系统自带的计划任务可以禁用吗,禁用会对系统稳定性和正常使用产生重大影响吗,格式:Task Name,Task Folder

总的来说,禁用这些计划任务可能会影响系统对问题的检测和诊断能力,以及应用程序兼容性和性能评估。然而,对系统稳定性和正常使用的影响应该相对较小。在禁用这些任务之前,请确保了解这些操作可能带来的潜在影响,并确保有其他方法来检测和解决潜在问题。

代码语言:javascript
复制
AnalyzeSystem,\Microsoft\Windows\Power Efficiency Diagnostics\
appuriverifierdaily,\Microsoft\Windows\ApplicationData\
appuriverifierinstall,\Microsoft\Windows\ApplicationData\
BgTaskRegistrationMaintenanceTask,\Microsoft\Windows\BrokerInfrastructure\
CleanupTemporaryState,\Microsoft\Windows\ApplicationData\
Consolidator,\Microsoft\Windows\Customer Experience Improvement Program\
CreateObjectTask,\Microsoft\Windows\CloudExperienceHost\
Diagnostics,\Microsoft\Windows\DiskFootprint\
DsSvcCleanup,\Microsoft\Windows\ApplicationData\
IndexerAutomaticMaintenance,\Microsoft\Windows\Shell\
MaintenanceTasks,\Microsoft\Windows\StateRepository\
Microsoft Compatibility Appraiser,\Microsoft\Windows\Application Experience\
Microsoft-Windows-DiskDiagnosticDataCollector,\Microsoft\Windows\DiskDiagnostic\
Microsoft-Windows-DiskDiagnosticResolver,\Microsoft\Windows\DiskDiagnostic\
PcaPatchDbTask,\Microsoft\Windows\Application Experience\
ProcessMemoryDiagnosticEvents,\Microsoft\Windows\MemoryDiagnostic\
ProgramDataUpdater,\Microsoft\Windows\Application Experience\
ResolutionHost,\Microsoft\Windows\WDI\
RunFullMemoryDiagnostic,\Microsoft\Windows\MemoryDiagnostic\
Schedule Maintenance Work,\Microsoft\Windows\UpdateOrchestrator\
Scheduled,\Microsoft\Windows\Diagnosis\
SDN Diagnostics Task,\Microsoft\Windows\Network Controller\
Secure-Boot-Update,\Microsoft\Windows\PI\
SilentCleanup,\Microsoft\Windows\DiskCleanup\
Sqm-Tasks,\Microsoft\Windows\PI\
StartupAppTask,\Microsoft\Windows\Application Experience\
StorageSense,\Microsoft\Windows\DiskFootprint\
Tpm-HASCertRetr,\Microsoft\Windows\TPM\
Tpm-Maintenance,\Microsoft\Windows\TPM\
UsbCeip,\Microsoft\Windows\Customer Experience Improvement Program\
Windows Defender Cache Maintenance,\Microsoft\Windows\Windows Defender\
Windows Defender Cleanup,\Microsoft\Windows\Windows Defender\
Windows Defender Scheduled Scan,\Microsoft\Windows\Windows Defender\
Windows Defender Signature,\Microsoft\Windows\Windows Defender\
Windows Defender Verification,\Microsoft\Windows\Windows Defender\
WinSAT,\Microsoft\Windows\Maintenance\

以下是提到的计划任务的简要描述和潜在影响:

代码语言:javascript
复制
以下是上述提到的计划任务的简要描述和潜在影响:

AnalyzeSystem:用于分析系统的电源效率。禁用可能会导致系统无法自动优化电源设置,但对系统稳定性和正常使用的影响应该较小。

appuriverifierdaily 和 appuriverifierinstall:用于验证应用程序兼容性。禁用可能会影响应用程序兼容性验证,但对系统稳定性和正常使用的影响应该较小。

BgTaskRegistrationMaintenanceTask:用于维护后台任务的注册。禁用可能会影响后台任务的注册和管理,但对系统稳定性和正常使用的影响应该较小。

CleanupTemporaryState 和 DsSvcCleanup:用于清理临时应用程序数据。禁用可能会导致临时数据未被清理,但对系统稳定性和正常使用的影响应该较小。

Consolidator:用于收集客户体验改进计划的数据。禁用可能会影响向 Microsoft 提供有关系统使用情况的数据,但对系统稳定性和正常使用的影响应该较小。

CreateObjectTask:用于创建云体验主机对象。禁用可能会影响与云服务的交互,但对系统稳定性和正常使用的影响应该较小。

Diagnostics(DiskFootprint):用于诊断磁盘空间使用情况。禁用可能会影响系统对磁盘空间使用的诊断和优化,但对系统稳定性和正常使用的影响应该较小。

IndexerAutomaticMaintenance:用于自动维护 Windows 搜索索引。禁用可能会影响搜索性能和索引更新,但对系统稳定性和正常使用的影响应该较小。

MaintenanceTasks:用于执行状态存储库的维护任务。禁用可能会影响状态存储库的性能和更新,但对系统稳定性和正常使用的影响应该较小。

Microsoft Compatibility Appraiser 和 ProgramDataUpdater:用于评估和更新应用程序兼容性。禁用可能会影响应用程序兼容性更新,但对系统稳定性和正常使用的影响应该较小。

Microsoft-Windows-DiskDiagnosticDataCollector 和 Microsoft-Windows-DiskDiagnosticResolver:用于收集和解析磁盘诊断数据。禁用可能会影响系统对磁盘问题的检测,但对系统稳定性和正常使用的影响应该较小。

PcaPatchDbTask:用于更新程序兼容性助手数据库。禁用可能会影响系统对程序兼容性的诊断,但对系统稳定性和正常使用的影响应该较小。

ProcessMemoryDiagnosticEvents:用于处理内存诊断事件。禁用可能会影响系统对内存问题的检测,但对系统稳定性和正常使用的影响应该较小。

ResolutionHost:用于 Windows 诊断基础结构(WDI)解析。禁用可能会影响系统对某些问题的诊断,但对系统稳定性和正常使用的影响应该较小。

RunFullMemoryDiagnostic:用于运行完整的内存诊断。禁用可能会影响系统对内存问题的检测,但对系统稳定性和正常使用的影响应该较小。

Schedule Maintenance Work:用于计划和执行 Windows 更新维护任务。禁用可能会影响 Windows 更新的安装和管理,但对系统稳定性和正常使用的影响应该较小。

Scheduled(Diagnosis):用于执行计划的系统诊断。禁用可能会影响系统对问题的检测和处理,但对系统稳定性和正常使用的影响应该较小。

SDN Diagnostics Task:用于诊断软件定义网络(SDN)控制器的问题。禁用可能会影响 SDN 控制器的诊断,但对系统稳定性和正常使用的影响应该较小。

Secure-Boot-Update:用于更新安全引导组件。禁用可能会影响安全引导的更新,但对系统稳定性和正常使用的影响应该较小。

SilentCleanup:用于在后台运行磁盘清理。禁用可能会导致磁盘空间未被自动清理,但对系统稳定性和正常使用的影响应该较小。

Sqm-Tasks:用于收集和发送软件质量度量(SQM)数据。禁用可能会影响向 Microsoft 提供有关软件使用情况的数据,但对系统稳定性和正常使用的影响应该较小。

StartupAppTask:用于启动应用程序体验任务。禁用可能会影响应用程序的启动性能,但对系统稳定性和正常使用的影响应该较小。

StorageSense:用于自动清理临时文件和回收站。禁用可能会导致这些文件未被自动清理,但对系统稳定性和正常使用的影响应该较小。

Tpm-HASCertRetr 和 Tpm-Maintenance:用于执行 TPM(可信平台模块)相关的维护任务。禁用可能会影响 TPM 的管理和更新,但对系统稳定性和正常使用的影响应该较小。

UsbCeip:用于收集 USB 设备的客户体验改进计划数据。禁用可能会影响向 Microsoft 提供有关 USB 设备使用情况的数据,但对系统稳定性和正常使用的影响应该较小。

Windows Defender Cache Maintenance, Windows Defender Cleanup, Windows Defender Scheduled Scan, Windows Defender Signature, 和 Windows Defender Verification:这些任务用于 Windows Defender 的各种功能,包括缓存维护、清理、计划扫描、签名更新和验证。禁用这些任务可能会影响 Windows Defender 的功能和系统安全性,但对系统稳定性和正常使用的影响应该较小。

WinSAT:用于评估计算机性能。禁用可能会导致系统无法自动评估性能,但对系统稳定性和正常使用的影响应该较小。

总的来说,禁用这些计划任务可能会影响系统的搜索性能、更新管理、安全引导、TPM 管理、应用程序启动性能、安全防护等方面。然而,对系统稳定性和正常使用的影响应该相对较小。在禁用这些任务之前,请确保了解这些操作可能带来的潜在影响,并确保有其他方法来检测和解决潜在问题。
代码语言:javascript
复制

以上计划任务,路径去重后如下:

\Microsoft\Windows\Shell\ (这个要非常谨慎!!!)

\Microsoft\Windows\BrokerInfrastructure\(这个要非常谨慎!!!)

代码语言:javascript
复制
\Microsoft\Windows\Power Efficiency Diagnostics\
\Microsoft\Windows\ApplicationData\
\Microsoft\Windows\BrokerInfrastructure\(这个要非常谨慎!!!)
\Microsoft\Windows\Customer Experience Improvement Program\
\Microsoft\Windows\CloudExperienceHost\
\Microsoft\Windows\DiskFootprint\
\Microsoft\Windows\Shell\ (这个要非常谨慎!!!)
\Microsoft\Windows\StateRepository\
\Microsoft\Windows\Application Experience\
\Microsoft\Windows\DiskDiagnostic\
\Microsoft\Windows\MemoryDiagnostic\
\Microsoft\Windows\WDI\
\Microsoft\Windows\UpdateOrchestrator\
\Microsoft\Windows\Diagnosis\
\Microsoft\Windows\Network Controller\
\Microsoft\Windows\PI\
\Microsoft\Windows\DiskCleanup\
\Microsoft\Windows\TPM\
\Microsoft\Windows\Windows Defender\
\Microsoft\Windows\Maintenance\

要禁用的话,powershell代码如下:

代码语言:javascript
复制
Get-ScheduledTask -TaskPath "\Microsoft\Windows\Power Efficiency Diagnostics\","\Microsoft\Windows\ApplicationData\","\Microsoft\Windows\Customer Experience Improvement Program\","\Microsoft\Windows\CloudExperienceHost\","\Microsoft\Windows\DiskFootprint\","\Microsoft\Windows\StateRepository\","\Microsoft\Windows\Application Experience\","\Microsoft\Windows\DiskDiagnostic\","\Microsoft\Windows\MemoryDiagnostic\","\Microsoft\Windows\WDI\","\Microsoft\Windows\UpdateOrchestrator\","\Microsoft\Windows\Diagnosis\","\Microsoft\Windows\Network Controller\","\Microsoft\Windows\PI\","\Microsoft\Windows\DiskCleanup\","\Microsoft\Windows\TPM\","\Microsoft\Windows\Windows Defender\","\Microsoft\Windows\Maintenance\" 2>$null | Disable-ScheduledTask 2>$null | ft -auto

或者

代码语言:javascript
复制
$taskPaths = @(
    "\Microsoft\Windows\Power Efficiency Diagnostics\",
    "\Microsoft\Windows\ApplicationData\",
    "\Microsoft\Windows\Customer Experience Improvement Program\",
    "\Microsoft\Windows\CloudExperienceHost\",
    "\Microsoft\Windows\DiskFootprint\",
    "\Microsoft\Windows\StateRepository\",
    "\Microsoft\Windows\Application Experience\",
    "\Microsoft\Windows\DiskDiagnostic\",
    "\Microsoft\Windows\MemoryDiagnostic\",
    "\Microsoft\Windows\WDI\",
    "\Microsoft\Windows\UpdateOrchestrator\",
    "\Microsoft\Windows\Diagnosis\",
    "\Microsoft\Windows\Network Controller\",
    "\Microsoft\Windows\PI\",
    "\Microsoft\Windows\DiskCleanup\",
    "\Microsoft\Windows\TPM\",
    "\Microsoft\Windows\Windows Defender\",
    "\Microsoft\Windows\Maintenance\"
)

foreach ($taskPath in $taskPaths) {
    Get-ScheduledTask -TaskPath $taskPath 2>$null | Disable-ScheduledTask 2>$null | ft -auto
}

请注意:禁用这些计划任务可能会影响系统的搜索性能、更新管理、安全引导、TPM 管理、应用程序启动性能、安全防护等方面。然而,对系统稳定性和正常使用的影响应该相对较小。在禁用这些任务之前,请确保了解这些操作可能带来的潜在影响,并确保有其他方法来检测和解决潜在问题。

有些计划任务不能乱禁用,比如同名的CreateObjectTask两个计划任务

代码语言:javascript
复制
Get-ScheduledTask | Where-Object { $_.TaskName -like "*CreateObjectTask*" }
  1. \Microsoft\Windows\CloudExperienceHost\CreateObjectTask:此任务用于创建云体验主机对象,以确保与云服务(如 OneDrive、Office 365 等)的连接和交互正常进行。这个任务通常在系统启动时运行。禁用此任务可能会影响与这些云服务的交互,但对系统稳定性和正常使用的影响应该较小。
  2. \Microsoft\Windows\Shell\CreateObjectTask:此任务用于创建 Shell 对象,以支持操作系统的基本功能。Shell 对象用于处理桌面、任务栏、开始菜单等系统界面元素。禁用此任务可能会影响系统界面的正常工作,从而对系统稳定性和正常使用产生影响。

在考虑禁用这些任务之前,请确保了解这些操作可能带来的潜在影响,并确保有其他方法来检测和解决潜在问题。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云服务器
云服务器(Cloud Virtual Machine,CVM)提供安全可靠的弹性计算服务。 您可以实时扩展或缩减计算资源,适应变化的业务需求,并只需按实际使用的资源计费。使用 CVM 可以极大降低您的软硬件采购成本,简化 IT 运维工作。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档