Time Your Script with Timespan Objects
Speed and consistency are the two main reasons people automate tasks using PowerShell. Give your script the same inputs and it should produce the same outputs. The consistency concept is easy. What about how much time is saved using PowerShell? We can achieve this using the Timespan object built into PowerShell. Start and Stop Times A rudimentary way of keeping track of time in your code is to use Get-Date. Saving the start time and end times using Get-Date allows…