Removal
清除系统日志¶
PowerShell 删除¶
# Usage
PowerShell -Command "& {Clear-Eventlog -Log 你要清理的日志(如Security)}"
PowerShell -Command "& {Clear-Eventlog -Log Application}"
PowerShell -Command "& {Clear-Eventlog -Log Security}"
PowerShell -Command "& {Clear-Eventlog -Log Setup}"
PowerShell -Command "& {Clear-Eventlog -Log System}"
PowerShell -Command "& {Clear-Eventlog -Log ForwardedEvents}"
# 一次性清空多种日志
PowerShell -Command "& {Clear-Eventlog -Log Application,System,Security}"
# Usage
PowerShell -Command "& Get-WinEvent -ListLog 你要清理的日志(如Security) -Force | % {Wevtutil.exe cl $_.Logname}"
PowerShell -Command "& Get-WinEvent -ListLog Security -Force | % {Wevtutil.exe cl $_.Logname}"
PowerShell -Command "& Get-WinEvent -ListLog Security -Force | % {Wevtutil.exe cl $_.Logname}"
PowerShell -Command "& Get-WinEvent -ListLog Security -Force | % {Wevtutil.exe cl $_.Logname}"
PowerShell -Command "& Get-WinEvent -ListLog Security -Force | % {Wevtutil.exe cl $_.Logname}"
# 一次性清空多种日志
PowerShell -Command "& Get-WinEvent -ListLog Application,Setup,Security -Force | % {Wevtutil.exe cl $_.Logname}"
wevtutil 删除¶
统计日志列表数目信息¶
查询指定类别的日志¶
全量删除¶
定向清理¶
# Usage
wevtutil qe <log name> /f:text /rd:true /c:<line>
wevtutil qe Security /f:text /rd:true /c:10
删除某指定单条记录¶
- 删除 EventRecordID 指定的日志
# 将 Windows 安全事件日志中除了 EventRecordID 为 1102 的条目之外的所有条目导出到指定的文件中
# "/q:*[System [(EventRecordID!=1102)]]" : 查询参数,用于筛选要导出的日志条目。
# 只导出 EventRecordID 不等于 1102 的日志条目
wevtutil epl Security tmp.evtx /q:"*[System[(EventID!=1102)]]"
# 只导出 EventRecordID 等于 1102 的日志条目
wevtutil epl Security tmp.evtx /q:"Event/System/EventID=1102"
- 结束 evenvmr 进程
- 替换原日志文件
- 重启日志服务
暴力删除日志文件¶
停止 Windows Event Log 服务¶
删除对应的文件¶
# 日志文件路径
# 绝对路径
C:\Windows\System32\winevt\Logs
# 相对默认位置
%SystemRoot%\System32\winevt\Logs\System.evtx
%SystemRoot%\System32\winevt\Logs\Security.evtx
%SystemRoot%\System32\winevt\Logs\Application.evtx
# IIS 日志
%SystemDrive%\inetpub\logs\LogFiles\W3SVC1\
Windows 远程连接日志¶
删除 Default.rdp 文件¶
使用attrib
去掉Default.rdp
文件:系统文件属性(S),隐藏文件属性(H)之后删除
注册表清理¶
查询远程连接在注册表中的键值
删除对应的键值
如使用当前机器作为跳板的话需要使用同步骤清理Servers下的键值
删除上面Servers
查询出来的键值
删除文件¶
Recent¶
del /f /s /q "%userprofile%\Recent*.*"
C:/Users/Administrator/AppData/Local/Microsoft/Windows/History
Amcache / RecentFileCache.bcf¶
Windows中的使用这两个文件来跟踪具有不同可执行文件的应用程序兼容性问题,它可用于确定可执行文件首次运行的时间和最后修改时间
在Windows 7、Windows Server 2008 R2等系统中,文件保存在 C:\Windows\AppCompat\Programs\RecentFileCache.bcf
,包含程序的创建时间、上次修改时间、上次访问时间和文件名
在Windows 8、Windows 10、Windows Server 2012等系统中,文件保存在 C:\Windows\AppCompat\Programs\Amcache.hve
,包含文件大小、版本、sha1、二进制文件类型等信息
Prefetch¶
预读取文件夹,用来存放系统已访问过的文件的预读信息,扩展名为PF。位置在 C:\Windows\Prefetch
JumpLists¶
记录用户最近使用的文档和应用程序,方便用户快速跳转到指定文件,位置在 %APPDATA%\Microsoft\Windows\Recent
格式化磁盘¶
彻底格式化¶
多次覆写文件
格式化某磁盘