title: Powershell write-eventlog writes duplicate entries
body: <p>I use PowerShell to parse some logs and write the result into a dedicated Windows Log. I meet the issue that <code>Write-EventLog</code> sometimes creates 2 times the same entry with a delay of 1 second. </p>
  
  <p>I don't get why that happens. - Have you also meet this issue and how did you solve it?</p>
  
  <p>Below my piece of code. - I added a <code>debug</code> which writes the content to a text-file. In the text-file there is only 1 time the content.</p>
  
  <pre><code>Function Publish-EventLog {
  
      param (                
          $logInfos
      )
  
      $eventlogs = @()
      Get-EventLog -List | Select-Object Log | ForEach-Object { $eventlogs += $_.Log }
  
      if ($eventlogs -contains('ABLogs')) {
          Write-Host "Log already exists." 
      } else {
          New-EventLog -LogName ABLogs -Source ABComputer
      }
  
      Write-EventLog -LogName ABLogs -Source ABComputer -EntryType $([string]$logInfos.WinEventType) -EventId $($logInfos.ABEventId) -Message $($logInfos.Details)   
  
      $runTime = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
      "Function, Publish: time : $($runTime)" | Out-File $logFile -Append
      "Function, Publish: logInfos.Details : $($logInfos.Details)" | Out-File $logFile -Append
  
  } #End Function Publish-EventLog
  </code></pre>