0

I am newish to PowerShell so still learning.

I am wanting to combine the two working commands below into one so the Out-File log will be combined with both the Users Interactive Logon and Logoff Security Event history ID's. Name of the log file does not matter.

Thanks in advance of any assistance.

Get-WinEvent -FilterHashTable @{LogName="Security";ID=4624} | where { $_.Message | Select-String "Logon Type:\s+2"} | Out-File -FilePath c:\Logs\LogIn.txt

Get-WinEvent -LogName Security| Where-Object {$_.ID -eq 4647} | Out-File -FilePath c:\Logs\LogOut.txt
  • This is a very common thing with many samples all over SO and the web. Just use the search box above or your favorite search engine to search for [Combine cmdlet output](https://stackoverflow.com/search?q=combine+cmdlet+output). – postanote Feb 12 '21 at 06:15
  • Does this answer your question? [combine multiple powershell cmdlet outputs](https://stackoverflow.com/questions/33099172/combine-multiple-powershell-cmdlet-outputs) – postanote Feb 12 '21 at 06:17

0 Answers0