通过使用本网站, 您同意 隐私政策.
接受
进入IT进入IT进入IT
  • 家
  • 信息技术专家
  • 技术
  • 微软
    • 天蓝色
    • 配置管理器/SCCM
    • 数字PM
    • 协调者
    • Hyper-V
    • 微软 Edge 预览体验
    • 微星指数
    • 办公室 365
    • 办公室内幕
    • 电力商业智能
    • Skype
    • SQL服务器
    • 团队
  • 视窗
    • Windows 管理中心
    • Windows客户端
    • Windows服务器
  • SCCM查询集合列表
阅读: PowerShell 将远程 PC 事件日志导出到本地 PC
字体调整器氨基酸
进入IT进入IT
字体调整器氨基酸
  • 家
  • 信息技术专家
  • 技术
  • 微软
  • 视窗
  • SCCM查询集合列表
搜索
  • 家
  • 信息技术专家
  • 技术
  • 微软
    • 天蓝色
    • 配置管理器/SCCM
    • 数字PM
    • 协调者
    • Hyper-V
    • 微软 Edge 预览体验
    • 微星指数
    • 办公室 365
    • 办公室内幕
    • 电力商业智能
    • Skype
    • SQL服务器
    • 团队
  • 视窗
    • Windows 管理中心
    • Windows客户端
    • Windows服务器
  • SCCM查询集合列表
IT专业人士

PowerShell 将远程 PC 事件日志导出到本地 PC

出版: 二月 12, 2024
3 最小阅读量
分享

PowerShell 将远程 PC 事件日志导出到本地 PC.

1. Open Powershell ISE with an account that has local admin access to remote PCs.

笔记: You also need to have the Sysinternals Tools installed and be able to call psloglist with a prior reference to its path pre-defined:

Set-Alias psloglist c:\windows\system32\psloglist.exe

2. Function calls for remote System Event logs;

Replace the REMOTE-PCNAME with the NetBIOS name of the PC you want to connect to and extract the logs from. 这 “start notepad” command should then open the log file on your PC to review. 还, you can change the last string or even delete it if you use another tool for logs. (举个例子 Cmtrace 或者 Notepad++)

function GetSysEventLogs
{ 
         $currDate = get-date -format MMddyyyy 
         $getDayDuration = Read-Host "Please enter the number of days of logs to extract" 
         psloglist \\REMOTE-PCNAME -d $getDayDuration -s system > c:\logs\REMOTE-PCNAME-sysevtlogs-$currDate.txt 
         Write-Host "Event logs saved to c:\logs\REMOTE-PCNAME-sysevtlogs-$currDate.txt" 
         start notepad c:\logs\REMOTE-PCNAME-sysevtlogs-$currDate.txt

}

3. Function calls for remote Application Event logs;

function GetAppEventLogs

{ 
         $currDate = get-date -format MMddyyyy 
         $getDayDuration = Read-Host "Please enter the number of days of logs to extract" 
         psloglist \\REMOTE-PCNAME -d $getDayDuration -s application > c:\logs\REMOTE-PCNAME-appevtlogs-$currDate.txt 
         Write-Host "Event logs saved to c:\logs\REMOTE-PCNAME-appevtlogs-$currDate.txt" 
         start notepad c:\logs\REMOTE-PCNAME-appevtlogs-$currDate.txt

}

4. Function calls for remote Security Event logs;

function GetSecEventLogs
{ 
         $currDate = get-date -format MMddyyyy 
         $getDayDuration = Read-Host "Please enter the number of days of logs to extract" 
         psloglist \\REMOTE-PCNAME -d $getDayDuration -s security > c:\logs\REMOTE-PCNAME-secevtlogs-$currDate.txt 
         Write-Host "Event logs saved to c:\logs\REMOTE-PCNAME-secevtlogs-$currDate.txt" 
         start notepad c:\logs\REMOTE-PCNAME-secevtlogs-$currDate.txt

}

Steps that this script do:
1) Prompt you for how many days of logs you want to extract out
2) Connect to the remote machine
3) Export the specific log to a *.TXT file
4) Copy the log back to your computer into c:\logs\
5) Open the file in Notepad

标记:Powershell视窗视窗 10
上一篇 DPM 删除特定恢复点
下一篇 Power BI Desktop June 2019 更新
发表评论 发表评论

发表回复 取消回复

您的电子邮件地址不会被公开. 必填字段已标记 *

该网站使用 Akismet 来减少垃圾邮件. 了解您的评论数据的处理方式.

翻译

English中文(简体)DanskNederlandsFrançaisDeutschItaliano한국어PolskiPortuguêsRomânăEspañolУкраїнська
经过 Transposh - translation plugin for wordpress

热门帖子

Windows Server 的系统要求 2016
Windows服务器
配置管理器查询集合列表
配置管理器查询集合列表
configmgr
在经典团队网站的新式页面上启用结构化/托管导航
技术
SCCM 无法从 MP 获取预期版本的 DP 位置
configmgr

最近的帖子

在 Ubuntu 上安装和配置 Fail2ban 以实现 SSH 保护 24.04
Linux
在AlmaLinux上启用和配置FirewallD
Linux
AlmaLinux中的用户创建和SSH密钥设置
Linux
如何在AlmaLinux上重置密码
Linux

© 2023 进入IT

转到移动版本
欢迎回来!

登录您的帐户

用户名或电子邮件地址
密码

丢失密码?