Advertisement
guyrleech

Get approximate process launch time

Aug 22nd, 2022
1,351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $ssstudio = Start-Process -filepath "C:\Windows\system32\mmc.exe" -ArgumentList '"C:\Program Files\Citrix\Desktop Studio\Studio.msc" "C:\Program Files\Citrix\Desktop Studio\LaunchConsole.exe"' -PassThru
  2.  
  3. ## change to whatever you need to match the title of the main window for the process you are measuring
  4. while( $ssstudio.MainWindowTitle -notmatch 'Citrix Studio')
  5. {
  6.     Start-Sleep -Milliseconds 333 ## make smaller for greater accuracy but with increased CPU
  7.     $ssstudio = Get-Process -id $ssstudio.Id -ErrorAction Stop
  8. }
  9. [void]$ssstudio.WaitForInputIdle()
  10.  
  11. [datetime]::Now - $ssstudio.StartTime
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement