-
清理臨時檔案:
powershellCopy CodeRemove-Item -Path "$env:TEMP\*" -Force -Recurse Remove-Item -Path "$env:LOCALAPPDATA\Temp\*" -Force -Recurse
-
清理回收站:
powershellCopy CodeClear-RecycleBin -Force
-
清理瀏覽器快取(例如清理 Chrome 快取):
powershellCopy CodeRemove-Item -Path "$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Cache\*" -Force -Recurse
-
清理 Windows 更新臨時檔案:
powershellCopy CodeGet-WindowsUpdateLog | Remove-WindowsUpdateLog
-
清理 Windows 錯誤報告和日誌檔案:
powershellCopy CodeGet-WinEvent -LogName "Application", "System" | Where-Object { $_.TimeCreated -lt (Get-Date).AddDays(-30) } | Remove-WinEvent
-
最佳化系統啟動項: 可以透過 PowerShell 管理登錄檔或啟動資料夾來禁用或管理啟動項,這需要一些謹慎操作。
-
清理遠端桌面連線歷史記錄:
powershellCopy CodeClear-History -CommandLineType "RemoteDesktop"
-
清理 Powershell 歷史記錄:
powershellCopy CodeClear-History
-
清理系統日誌檔案:
powershellCopy CodeClear-EventLog -LogName "Application", "System"
-
清理 IIS 日誌檔案:
powershellCopy CodeGet-ChildItem -Path "C:\inetpub\logs\LogFiles" | Remove-Item -Force -Recurse
-
清理臨時 IIS 檔案:
powershellCopy CodeRemove-Item -Path "C:\Windows\Temp\*" -Force -Recurse
-
清理 Windows 更新快取:
powershellCopy CodeClean-CMUpdatePackage
-
清理 Windows Defender 定義檔案快取:
powershellCopy CodeClear-MpThreatCatalog
-
清理 Windows 更新日誌和臨時檔案:
powershellCopy CodeRemove-Item -Path "$env:LOCALAPPDATA\Temp\WindowsUpdateLogs\*" -Force -Recurse
-
清理 PowerShell 快取:
powershellCopy CodeClear-Host
-
清理使用者臨時檔案和配置:
powershellCopy CodeRemove-Item -Path "$env:LOCALAPPDATA\Temp\*" -Force -Recurse Remove-Item -Path "$env:APPDATA\Microsoft\Windows\Recent\*" -Force -Recurse
-
清理 Windows 搜尋索引:
powershellCopy CodeGet-WindowsSearchIndex | Reset-WindowsSearchIndex
-
清理 Windows 更新備份檔案:
powershellCopy CodeDism.exe /Online /Cleanup-Image /StartComponentCleanup /ResetBase
-
清理舊的 Windows 安裝檔案:
powershellCopy CodeDism.exe /Online /Cleanup-Image /StartComponentCleanup /ResetBase
-
清理 Windows Event 日誌檔案:
powershellCopy CodeClear-EventLog -LogName "Application", "System"
-
清理 Windows Update 下載的臨時檔案:
powershellCopy CodeRemove-Item -Path "$env:SYSTEMROOT\SoftwareDistribution\Download\*" -Force -Recurse
-
清理 Windows 更新錯誤報告:
powershellCopy CodeRemove-Item -Path "$env:LOCALAPPDATA\Microsoft\Windows\Windows Error Reporting\*" -Force -Recurse
-
清理 PowerShell 臨時檔案:
powershellCopy CodeRemove-Item -Path "$env:LOCALAPPDATA\Microsoft\Windows\PowerShell\*" -Force -Recurse
-
清理 Windows 應用程式日誌:
powershellCopy CodeGet-WinEvent -LogName "Application" | Remove-WinEvent
-
清理 Windows 防火牆日誌:
powershellCopy CodeGet-NetFirewallProfile | Get-NetFirewallLog | Clear-NetFirewallLog
-
清理 Windows 系統日誌:
powershellCopy CodeGet-WinEvent -LogName "System" | Remove-WinEvent
-
清理 Windows 執行時元件日誌:
powershellCopy CodeGet-WinEvent -LogName "Runtime" | Remove-WinEvent
-
清理 Windows 應用程式故障診斷日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Diagnostics-Performance/Operational" | Remove-WinEvent
-
清理 IIS 日誌(特定日期範圍內):
powershellCopy CodeGet-ChildItem -Path "C:\inetpub\logs\LogFiles" -Recurse | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-30)} | Remove-Item -Force
-
清理 Windows PowerShell 工作流和任務登錄檔日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-PowerShell/Operational" | Remove-WinEvent
-
清理 Windows 安全審計日誌:
powershellCopy CodeGet-WinEvent -LogName "Security" | Remove-WinEvent
-
清理 Windows 元件事件日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-WinINet/Analytic" | Remove-WinEvent
-
清除臨時檔案:
powershellCopy CodeRemove-Item -Path "$env:TEMP\*" -Force -Recurse
-
清除 Windows 更新快取:
powershellCopy CodeRemove-Item -Path "$env:SystemRoot\SoftwareDistribution\Download\*" -Force -Recurse
-
清除事件日誌(需以管理員身份執行):
powershellCopy Codewevtutil el | ForEach-Object {wevtutil cl $_}
-
清除使用者臨時檔案:
powershellCopy CodeRemove-Item -Path "$env:USERPROFILE\AppData\Local\Temp\*" -Force -Recurse
-
清除 Internet Explorer 快取:
powershellCopy CodeClear-IECache
-
清除 Windows Store 快取:
powershellCopy CodeGet-AppxPackage -AllUsers | Where-Object {$_.Name -like "*WindowsStore*"} | Remove-AppxPackage
-
清除 PowerShell 快取:
powershellCopy CodeClear-History
-
清除記憶體:
powershellCopy CodeClear-Host
-
最佳化系統磁碟:
powershellCopy CodeOptimize-Volume -DriveLetter C -Defrag -Verbose
-
清理 Windows PowerShell Core 日誌:
powershellCopy CodeGet-WinEvent -LogName "Windows PowerShell Core/Operational" | Remove-WinEvent
-
清理 Windows Defender 防病毒日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Windows Defender/Operational" | Remove-WinEvent
-
清理 Hyper-V 虛擬機器日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Hyper-V-Worker-Admin" | Remove-WinEvent
-
清理 Windows 搜尋索引日誌:
powershellCopy CodeGet-WinEvent -LogName "Windows Search/Operational" | Remove-WinEvent
-
清理 DNS 伺服器日誌:
powershellCopy CodeGet-WinEvent -LogName "DNS Server/Analytical" | Remove-WinEvent
-
清理 DHCP 伺服器日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-DHCP Server Events/Admin" | Remove-WinEvent
-
清理 Windows 版本管理日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-WindowsUpdateClient/Operational" | Remove-WinEvent
-
清理 Windows 核心事件日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Kernel-EventTracing/Operational" | Remove-WinEvent
-
清理 Windows 遠端桌面服務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-TerminalServices-LocalSessionManager/Operational" | Remove-WinEvent
-
清理 Windows 儲存空間直通日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-StorageSpaces-Driver/Operational" | Remove-WinEvent
-
清理 Windows 程序活動日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-ProcessExit/Operational" | Remove-WinEvent
-
清理 Windows 程序啟動日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-ProcessCreation/Operational" | Remove-WinEvent
-
清理 Windows 網路共享日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Shell-Core/Operational" | Remove-WinEvent
-
清理 Windows 升級日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-WindowsUpdateClient/Operational" | Remove-WinEvent
-
清理 Windows 儲存傳輸服務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-StorDiag/Operational" | Remove-WinEvent
-
清理 Windows 連線性解析器日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-ConnectivityAnalyzer/Operational" | Remove-WinEvent
-
清理 Windows 裝置管理器日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider/Admin" | Remove-WinEvent
-
清理 Windows 列印服務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-PrintService/Operational" | Remove-WinEvent
-
清理 Windows 驅動程式框架服務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-DriverFrameworks-UserMode/Operational" | Remove-WinEvent
-
清理 Windows 儲存日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Storage-ClassPnP/Operational" | Remove-WinEvent
-
清理 Windows 檔案共享服務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-SMBServer/Audit" | Remove-WinEvent
-
清理 Windows 安全審計日誌:
powershellCopy CodeGet-WinEvent -LogName "Security/AuditSuccess", "Security/AuditFailure" | Remove-WinEvent
-
清理 Windows 系統事件通知服務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Sens/Operational" | Remove-WinEvent
-
清理 Windows 遠端登錄檔服務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-RemoteRegistry/Operational" | Remove-WinEvent
-
清理 Windows 電源管理日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Power-Troubleshooter/Operational" | Remove-WinEvent
-
清理 Windows DHCP 客戶端日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-DHCP-Client/Operational" | Remove-WinEvent
-
清理 Windows 安全中心日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-SecurityCenter/Operational" | Remove-WinEvent
-
清理 Windows 虛擬化日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Hyper-V-Worker-Admin/Operational" | Remove-WinEvent
-
清理 Windows 虛擬磁碟服務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-VirtualDiskService/Operational" | Remove-WinEvent
-
清理 Windows 網路連線管理器日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-NetworkConnectionBroker/Operational" | Remove-WinEvent
-
清理 Windows 安全日誌:
powershellCopy CodeGet-WinEvent -LogName "Security" | Remove-WinEvent
-
清理 Windows 自動更新日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-WindowsUpdateClient/Operational" | Remove-WinEvent
-
清理 Windows 遠端桌面服務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-TerminalServices-LocalSessionManager/Operational" | Remove-WinEvent
-
清理 Windows 應用程式元件日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-AppModel-State/Operational" | Remove-WinEvent
-
清理 Windows 元件服務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Com/Operational" | Remove-WinEvent
-
清理 Windows 啟動日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Kernel-Boot/Operational" | Remove-WinEvent
-
清理 Windows 容器日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Containers/Operational" | Remove-WinEvent
-
清理 Windows 定時任務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-TaskScheduler/Operational" | Remove-WinEvent
-
清理 Windows 裝置健康狀況日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-DeviceHealth-Attestation/Operational" | Remove-WinEvent
-
清理 Windows 系統故障排除日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Diagnosis-DPS/Operational" | Remove-WinEvent
-
清理 Windows 檔案共享服務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-SMBServer/Operational" | Remove-WinEvent
-
清理 Windows 程序活動日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-ProcessCreation/Operational" | Remove-WinEvent
-
清理 Windows 工作列通知區域日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Shell-Core/Operational" | Remove-WinEvent
-
清理 Windows 儲存空間日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-StorageSpaces-Driver/Operational" | Remove-WinEvent
-
清理 Windows 證書服務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-CertificateServices-Client-Lifecycle-System/Operational" | Remove-WinEvent
-
清理 Windows 移動裝置管理日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Mobile-Broadband-Experience/Operational" | Remove-WinEvent
-
清理 Windows 系統恢復日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-SystemRestore/Operational" | Remove-WinEvent
-
清理 Windows 核心事件追蹤日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Kernel-EventTracing/Operational" | Remove-WinEvent
-
清理 Windows 安全審計日誌:
powershellCopy CodeGet-WinEvent -LogName "Security" | Remove-WinEvent
-
清理 Windows 應用程式錯誤日誌:
powershellCopy CodeGet-WinEvent -LogName "Application" | Remove-WinEvent
-
清理 Windows 系統錯誤日誌:
powershellCopy CodeGet-WinEvent -LogName "System" | Remove-WinEvent
-
清理 Windows PowerShell 日誌:
powershellCopy CodeGet-WinEvent -LogName "Windows PowerShell" | Remove-WinEvent
-
清理 Windows DNS 審計日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-DNS-Client/Operational" | Remove-WinEvent
-
清理 Windows DHCP 審計日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-DHCP-Client/Operational" | Remove-WinEvent
-
清理 Windows 檔案複製服務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-DfsSvc/Operational" | Remove-WinEvent
-
清理 Windows 轉發事件跟蹤日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-EventForwarding/Operational" | Remove-WinEvent
-
清理 Windows 遠端桌面服務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational" | Remove-WinEvent
-
清理 Windows 檔案伺服器資源管理器日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-SRMSVC/Operational" | Remove-WinEvent
-
清理 Windows 儲存池日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-StorageSpaces-ManagementAgent/Operational" | Remove-WinEvent
-
清理 Windows 掃描管理器日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-ScanManagement/Operational" | Remove-WinEvent
-
清理 Windows 分析引擎日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Resource-Exhaustion-Detector/Operational" | Remove-WinEvent
-
清理 Windows 網路連線日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-TCP/IP/Operational" | Remove-WinEvent
-
清理 Windows 網路驅動程式日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-NDIS/Operational" | Remove-WinEvent
-
清理 Windows 檔案保護日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Wininit/Operational" | Remove-WinEvent
-
-
清理 Windows 檔案複製服務除錯日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-DfsSvc/Debug" | Remove-WinEvent
-
清理 Windows 遠端管理服務日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-TerminalServices-LocalSessionManager/Operational" | Remove-WinEvent
-
清理 Windows 容器日誌:
powershellCopy CodeGet-WinEvent -LogName "Microsoft-Windows-Containers/Operational" | Remove-WinEvent
-
清理 Windows 叢集日誌:
```powershell Get-WinEvent -LogName "Microsoft-Windows-FailoverClustering/Operational" | Remove-WinEvent ```
- 清理 Windows 資料保護日誌:
```powershell Get-WinEvent -LogName "Microsoft-Windows-DataProtection-Server/Operational" | Remove-WinEvent ```
- 清理 Windows 資料保護日誌:
```powershell Get-WinEvent -LogName "Microsoft-Windows-DataProtection-Client/Operational" | Remove-WinEvent ```
- 清理 Windows 資料庫引擎服務日誌:
```powershell Get-WinEvent -LogName "Microsoft-Windows-SQLEngine/Operational" | Remove-WinEvent ```
-