This simple chunk of code will find newly launched processes (specifically their process IDs) that have started between a given period:
$existingProcessPids = Get-Process -ErrorAction SilentlyContinue | Select -ExpandProperty Id
#new processes launched here
start-process notepad.exe
start-process cmd.exe
$newProcessIds = Get-Process -ErrorAction SilentlyContinue | where-object { $existingProcessPids -notcontains $_.Id } | select -ExpandProperty Id
write-host $newProcessIds
![Find Newly Launched Processes](https://www.alkanesolutions.co.uk/wp-content/uploads/2023/12/find-newly-launched-processes-300x169.png)
![Find Newly Launched Processes](https://www.alkanesolutions.co.uk/wp-content/themes/twentyeleven-child/images/application-packaging-services-blog.png)