Hi all
This is my first port here.
I need help putting together a PowerShell script to run selected executables and record how long they take to complete individually and then an overall time for them all.
The code below is my starting point for a quick running .exe. Others will run for several minutes up to a few hours.
Current Code...
$result = Measure-Command {Invoke-Expression"& C:\Jobs\Ni-IntegrationJobs\NiIntegration.exe 1" | Out-Host}
The path C:\Jobs\Ni-IntegrationJobs\NiIntegration.exe is a fixed pathway. Using the numbers 1 through 10 determins which part of the integration script runs.
{Invoke-Expression"& C:\Jobs\Ni-IntegrationJobs\NiIntegration.exe 1" | Out-Host}
{Invoke-Expression"& C:\Jobs\Ni-IntegrationJobs\NiIntegration.exe 2" | Out-Host}
{Invoke-Expression"& C:\Jobs\Ni-IntegrationJobs\NiIntegration.exe 3" | Out-Host}
{Invoke-Expression"& C:\Jobs\Ni-IntegrationJobs\NiIntegration.exe etc" | Out-Host}
Currently I am commenting out lines of code and running selected jobs. I would like to be able to input the jobs I need ie 1, 3, 6 & 10 and execute them. Each job would record how long it took to complete in hours, min, sec and millisec. A summary of the overall time the scripts took to complete in hours, min, sec and millisec.
If my post is not clear, please let me know.
Any links to previous posts on the site, code snippets or suggestions on how to do this would be a great start for me.
Thanks in advance
Jak
Write-host
$result.Seconds
Read-Host