Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Get-Eventlog script to return certain parts of -Message

$
0
0

Hello,

So i run this script against one of my Backup servers 

$Machine = "Machine1"Get-Eventlog -Logname Application -Source "Backup Exec" -EntryType Warning -ComputerName $Machine  -After (Get-Date).AddDays(-1) | Select-Object -ExpandProperty message


Output

Backup Exec Alert: Job Completed with Exceptions (Server: "machine1") (Job: "Machine1 Daily INC Backup") The job completed successfully. However, the following conditions were encountered: 86 files were skipped.

My issue is I only want my script to return a certain part of the output. i.e.

(Server: "machine1") (Job: "Machine1 Daily INC Backup") The job completed successfully.

Does anyone know I would go about achieving this? converting it to a string or trimming does't seem to work :(

Thanks in advance

J



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>