>>81
別スレッドで非同期にフォームを起動すればいい

using namespace System.Windows.Forms
using assembly System.Windows.Forms

$label = [Label]@{ Dock = "Fill"; Font = "Meiryo,20" }
$form = [Form]@{ Size = "350,100" }
$form.Controls.Add($label)

$runspace = [RunspaceFactory]::CreateRunspace()
$runspace.Open()
$pipeline = $runspace.CreatePipeline()
$pipeline.Commands.AddScript({ param ($form) $form.ShowDialog() })
$pipeline.Commands[0].Parameters.Add("form", $form)
$pipeline.InvokeAsync()

foreach ($p in 1..10) {
  if ($Runspace.RunspaceAvailability -ne "Busy") { break }
  $time = [datetime]::Now
  $label.Text = $time
  sleep 1
}

if ($Runspace.RunspaceAvailability -eq "Busy") { $form.Close() }
$runspace.Dispose()