move check values to left side of comparison

This commit is contained in:
2023-10-05 13:33:28 -04:00
parent ab2a1821d5
commit 983952ee99
3 changed files with 4 additions and 5 deletions
+1 -2
View File
@@ -26,7 +26,7 @@ $Logs = Get-WinEvent -ListLog *
ForEach ($Log in $Logs) {
$LogName = $Log.LogName
Write-Output "Exporting events from: ${LogName}"
Try { Get-WinEvent -LogName $LogName -FilterXPath "Event/System[Level=1 or Level=2 or Level=3]" -ErrorAction Stop | Select LogName,ProviderName,Level,Id,Message | Export-Csv -Path "${ExportedEvents}" -Append -NoTypeInformation -ErrorAction Stop }
Try { Get-WinEvent -LogName $LogName -FilterXPath "Event/System[Level=1 or Level=2 or Level=3]" -ErrorAction Stop | Select-Object LogName,ProviderName,Level,Id,Message | Export-Csv -Path "${ExportedEvents}" -Append -NoTypeInformation -ErrorAction Stop }
Catch { Write-Error $_.Exception.Message }
}
@@ -41,7 +41,6 @@ Catch { Write-Error $_.Exception.Message }
# Upload to SFTP site
If ( Test-Path $ExportedEvents ) {
$SFTPCred = New-Object System.Management.Automation.PSCredential($SFTPUser,$SFTPPass)
$DestinationFile = $(Split-Path -Path $ExportedEvents -Leaf)
# Wait for a random amount of time before starting the connection and uploading
Start-Sleep -Seconds $(Get-Random -Minimum 1 -Maximum 120)