move check values to left side of comparison
This commit is contained in:
+1
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user