The image where you show the task manager is for the ISE process. But in your script you are launching a separate Powershell.exe to run your Generatinghash script. If you were doing a lot of testing then the ISE memory usage will include all of the variable and data that you've been playing with. Close ISE and reopen it
When you run it like this... Measure-Command {"C:\Pathtoscript\Myscript.ps1"} Then that script will execute in the memory space of the Powershell.exe process that running the calling script.
but the estimate time is still not right
What's not right about it? For your 2 images in your last post, we have no context. What are you running?
Add code to the Generatinghash script to report on execution time.
$StartTime = get-date
start-sleep -Seconds 5
$RunTime = New-TimeSpan -Start $StartTime -End (get-date)
"Execution time was {0} hours, {1} minutes, {2} seconds and {3} milliseconds." -f $RunTime.Hours, $RunTime.Minutes, $RunTime.Seconds, $RunTime.Milliseconds