Hallo.
Ich bin neu hier.
Ich fange grade an mit Powershell ein Skript zu schreiben und wollte da die GUI benutzen.
Jetzt habe ich da ein Problem mit der msgbox.
Hier mein Skript
Add-Type -AssemblyName System.Windows.Forms $Form2 = New-Object system.Windows.Forms.Form $Form2.Text = "!ACHTUNG!" $Form2.Controls.Add($Label2) $Form2.Width = 470 $Form2.Height = 500 $Form3 = New-Object system.Windows.Forms.Form $Form3.Text = "!Test!" $Form3.Controls.Add($Label2) $Form3.Width = 100 $Form3.Height = 100 $Button1 = New-Object System.Windows.Forms.Button $Button1.Location = New-Object System.Drawing.Size(250,100) #Breite , Höhe $Button1.Size = New-Object System.Drawing.Size(75,23) $Button1.Text = „ABBRECHEN“ $Button1.Add_Click({$form2.close()}) $Form2.Controls.Add($Button1) $Button2 = New-Object System.Windows.Forms.Button $Button2.Location = New-Object System.Drawing.Size(250,50) $Button2.Size = New-Object System.Drawing.Size(75,23) $Button2.Text = „OK“ $Button2.Add_Click({$form3.showdialog()}) $Form2.Controls.Add($Button2) $Button3 = New-Object System.Windows.Forms.button $Button3.Location = New-Object System.Drawing.Size(10,100) $Button3.Size = New-Object System.Drawing.Size(75,30) $Button3.Text = „MSGBOX“ $Button3.Add_Click({$Result = [system.Windows.Forms.MessageBox]::Show("Wollen sie die form3 öffnen?","Frage an den Benutzer",1,[system.Windows.Forms.MessageBoxIcon]::Exclamation)}) $Form2.Controls.Add($Button3) [system.Windows.Forms.MessageBoxButtons] $OK = New-Object System.Windows.Forms.messageboxbutton $OKCancel.Add_Click({$form3.showdialog()}) If ($Result -eq "OK") { $ok = $form3.showdialog() } else { # keine Aktion ausführen } $form2.ShowDialog() Ich möchte das mit dem Button ok die Form 3 geöffnet wird und sonst nichts
mfg