Powershell图形界面窗口关闭提示框

Add-Type -AssemblyName System.Windows.Forms

$PowerShellForms = New-Object System.Windows.Forms.Form
$PowerShellForms.ClientSize = New-Object System.Drawing.Size(960, 720)
$PowerShellForms.MinimumSize = $PowerShellForms.Size
$PowerShellForms.BackColor = 'black'

$PowerShellForms.Add_FormClosing([System.Windows.Forms.FormClosingEventHandler]{
    $a = [System.Windows.Forms.MessageBox]::Show($PowerShellForms, '你确定要退出程序吗?', '退出程序', [System.Windows.Forms.MessageBoxButtons]::OKCancel, [System.Windows.Forms.MessageBoxIcon]::Question, [System.Windows.Forms.MessageBoxDefaultButton]::Button1)
})

$PowerShellForms.ShowDialog()

我用Windows的powershell制作一个GUI程序,现在想要一个关闭窗口的确认框,却怎么也做不到,我应该怎么办?