-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGet-Log.ps1
43 lines (31 loc) · 985 Bytes
/
Get-Log.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<#PSScriptInfo
.DESCRIPTION Lists the Events from a LogFile generated by Write-Log
.VERSION 1.0.0.0
.GUID 2e148d97-aa8b-47bb-8542-3e8f64e9753c
.AUTHOR Tom Stryhn
.COMPANYNAME Tom Stryhn
.COPYRIGHT 2023 (c) Tom Stryhn
.TAGS PowerShell Log
.LICENSEURI https://github.com/tomstryhn/PowerShell/blob/main/LICENSE
.PROJECTURI https://github.com/tomstryhn/PowerShell/Universal/Get-Log/
#>
function Get-Log {
[CmdletBinding()]
param (
# The Path to the actual LogFile
[Parameter(
Mandatory = $true,
Position = 0
)]
[ValidateScript(
{
if ($_){ Test-Path $_}
})]
[string]
$LogPath
)
process {
# Simply reads the Content of the LogFile as CSV Content and adds Headers to the Data
Get-Content -Path $LogPath | ConvertFrom-Csv -Delimiter "`t" -Header 'TimeStamp','LogLevel','Message'
}
}