Skip to content

Commit a68e780

Browse files
committed
Update Get-LTError
1 parent 2c0f192 commit a68e780

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

LabTech.psm1

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,17 +1744,17 @@ Function Update-LTService{
17441744
}#End End
17451745
}#End Function Update-LTService
17461746

1747-
Function Get-LTError{
1747+
Function Get-LTErrors{
17481748
<#
17491749
.SYNOPSIS
17501750
This will pull the %ltsvcdir%\LTErrors.txt file into an object.
17511751
17521752
.EXAMPLE
1753-
Get-LTError | where {(Get-date $_.Time) -gt (get-date).AddHours(-24)}
1753+
Get-LTErrors | where {(Get-date $_.Time) -gt (get-date).AddHours(-24)}
17541754
Get a list of all errors in the last 24hr
17551755
17561756
.EXAMPLE
1757-
Get-LTError | Out-Gridview
1757+
Get-LTErrors | Out-Gridview
17581758
Open the log file in a sortable searchable window.
17591759
17601760
.NOTES
@@ -1771,7 +1771,7 @@ Function Get-LTError{
17711771
Purpose/Change: Changed Erroraction from Stop to unspecified to allow caller to set the ErrorAction.
17721772
17731773
Update Date: 1/26/2019
1774-
Purpose/Change: Update for better international date parsing support
1774+
Purpose/Change: Update for better international date parsing support. Function rename.
17751775
17761776
.LINK
17771777
http://labtechconsulting.com
@@ -1788,12 +1788,12 @@ Function Get-LTError{
17881788

17891789
Process{
17901790
if ($(Test-Path -Path "$BasePath\LTErrors.txt") -eq $False) {
1791-
Write-Error "ERROR: Line $(LINENUM): Unable to find log."
1791+
Write-Error "ERROR: Line $(LINENUM): Unable to find lelog."
17921792
return
17931793
}
17941794
Try{
17951795
$errors = Get-Content "$BasePath\LTErrors.txt"
1796-
$errors = $errors -join ' ' -split ':::'
1796+
$errors = $errors -join ' ' -split '::: '
17971797
foreach($Line in $Errors){
17981798
$items = $Line -split "`t" -replace ' - ',''
17991799
if ($items[1]){
@@ -1818,7 +1818,8 @@ Function Get-LTError{
18181818
Else {$Error[0]}
18191819
Write-Debug "Exiting $($myInvocation.InvocationName) at line $(LINENUM)"
18201820
}#End End
1821-
}#End Function Get-LTError
1821+
}#End Function Get-LTErrors
1822+
Set-Alias -Name Get-LTError -Value Get-LTErrors
18221823

18231824
Function Reset-LTService{
18241825
<#
@@ -2518,7 +2519,7 @@ Function Get-LTProbeErrors{
25182519
return
25192520
}
25202521
$errors = Get-Content "$BasePath\LTProbeErrors.txt"
2521-
$errors = $errors -join ' ' -split ':::'
2522+
$errors = $errors -join ' ' -split '::: '
25222523
Try {
25232524
Foreach($Line in $Errors){
25242525
$items = $Line -split "`t" -replace ' - ',''
@@ -3538,7 +3539,7 @@ Function Initialize-LTServiceModule{
35383539
$PublicFunctions=@(((@"
35393540
ConvertFrom-LTSecurity
35403541
ConvertTo-LTSecurity
3541-
Get-LTError
3542+
Get-LTErrors
35423543
Get-LTLogging
35433544
Get-LTProbeErrors
35443545
Get-LTProxy
@@ -3564,6 +3565,7 @@ Update-LTService
35643565
"@) -replace "[`r`n,\s]+",',') -split ',')
35653566

35663567
$PublicAlias=@(((@"
3568+
Get-LTError
35673569
ReInstall-LTService
35683570
"@) -replace "[`r`n,\s]+",',') -split ',')
35693571

0 commit comments

Comments
 (0)