Q:

PowerShell - Why is my button not clickable during a while loop?

This is my function:
Function StartProgress
{
    $x = 600
    $length = $x / 100
        while($x -gt 0) {
        $min = [int](([string]($x/60)).split('.')[0])
        $lblCnt.Text = " " + $min + " minutes " + ($x % 60) + " seconds left"
        $pbrCnt.Value = $pbrCnt.Maximum - $x
        Start-Sleep -Seconds 1
        $x--
        }
}

and I have added it here:
$timer.add_Tick({StartProgress})

In the main form there's a button that isn't clickable during my while loop. Why?

A:

As has been pointed out, forcing a synchronous sleep with Start-Sleep blocks the UI thread as a whole and makes your form unresponsive.
Instead of using Start-Sleep, let the timer invoke your function periodically, once every second; you then need to keep track of your state using a script-level variable:
$script:x = 600

Function StartProgress {
  $length = $script:x / 100
  $min = [int](([string]($script:x / 60)).split('.')[0])
  $lblCnt.Text = " " + $min + " minutes " + ($script:x % 60) + " seconds left"
  $pbrCnt.Value = $pbrCnt.Maximum - $script:x
  if (--$script:x -eq 0) { $timer.Dispose() }
}

$timer.Interval = 1000 # 1 sec.
$timer.add_Tick({StartProgress})
$timer.Start()

Note how .Dispose() is called on $timer when $script:x reaches 0, to prevent further events from getting generated; if processing stops earlier, you must call $timer.Dispose() manually.

