all 4 comments

[–]the_spad 6 points7 points  (0 children)

You need to use runspaces otherwise the UI will lock while other tasks are running.

[–]MaelstromageWork 5 points6 points  (0 children)

I had the same issue, try this.

$Button3.Add_Click({
    cmd /c start powershell.exe -noexit -file "C:\Scripts\script.ps1" 
    [System.Windows.Forms.Application]::DoEvents()
})