Does Measure-Command report inaccurate time?

I have a script that I had to measure the runtime, however, when I use Measure-Command, I get what appears to be inaccurate information. For example, I timed the script itself, and it takes about 15 seconds to complete. However, here are the last two exits. As you can see, one of them is in negative numbers, and the other reports only 1 second. Any clue as to what is happening?

Days : 0 Hours : 0 Minutes : 0 Seconds : 0 Milliseconds : -538 Ticks : -5382963 TotalDays : -6.23028125E-06 TotalHours : -0.00014952675 TotalMinutes : -0.008971605 TotalSeconds : -0.5382963 TotalMilliseconds : -538.2963 Days : 0 Hours : 0 Minutes : 0 Seconds : 1 Milliseconds : 629 Ticks : 16299566 TotalDays : 1.88652384259259E-05 TotalHours : 0.000452765722222222 TotalMinutes : 0.0271659433333333 TotalSeconds : 1.6299566 TotalMilliseconds : 1629.9566 

Here is the command that I run Measure-Command {MoveVM-Folder.ps1}. The following is the contents of the MoveVM script folder.

 $VMs = Get-VM -Location $Cluster $Imports = Import-Csv $ImportFile foreach ($Import in $Imports) { $VMs | where {$_.Name -eq $Import.VMName} | Move-VM -Destination $Import.DestFolder } 

Let me know if this helps.

+4
source share
1 answer

If this happens irregularly, it may just be an explanation that your system clock is โ€œwrongโ€ and updated during the run.

0
source

Source: https://habr.com/ru/post/1334396/


All Articles