ethercat-linux/scripts/tc-check-system.ps1

13 lines
1008 B
PowerShell
Raw Normal View History

#Requires -Version 5.1
Write-Host "=== TwinCAT Events (last 30 min) ===" -ForegroundColor Cyan
Get-WinEvent -FilterHashtable @{LogName='Application','System'; StartTime=(Get-Date).AddMinutes(-30)} -ErrorAction SilentlyContinue |
Where-Object { $_.Message -like '*TwinCAT*' -or $_.ProviderName -like '*TwinCAT*' } |
Select-Object TimeCreated, ProviderName, Id, LevelDisplayName, @{N='Message';E={$_.Message -replace "`r`n",' ' -replace "`n",' ' | ForEach-Object { $_.Substring(0,[Math]::Min(200,$_.Length)) }} } |
Format-Table -AutoSize
Write-Host "=== TwinCAT Services ===" -ForegroundColor Cyan
Get-Service | Where-Object { $_.Name -like '*TwinCAT*' -or $_.DisplayName -like '*TwinCAT*' } | Select-Object Name, DisplayName, Status, StartType | Format-Table -AutoSize
Write-Host "=== TwinCAT Processes ===" -ForegroundColor Cyan
Get-Process | Where-Object { $_.ProcessName -like '*Tc*' -or $_.ProcessName -like '*TwinCAT*' } | Select-Object ProcessName, Id, StartTime | Format-Table -AutoSize