Tuesday, January 21, 2020

Reporting Script Duration

Currently working on a migration project where the source and target environments are quite large. We have a script that queries all mailboxes in the source and matches them to a target object.

The script takes 10-12 hours to run. We're making tweaks and want to see the effect, but we're not going to watch the script to verify the time to complete.

Here's a little bit of PowerShell that you can add to any script to measure the time to complete:

 #Start of Script  
 $start = Get-Date  
 
 
 #End of script  
 $end = Get-Date  
 
 # Calculate elapsed time  
 # Output in format hh:mm:ss  
 Write-Host “Script run time”  
 Write-Host $($end-$start)  

1 comment:

  1. Thanks for the information your article brings. I see the novelty of your article. I will share it for everyone to read together. I appreciate the amount of research you have done on Windows Versions. I look forward to reading many articles from you.

    ReplyDelete