Quantcast
Viewing all articles
Browse latest Browse all 2314

Dialogfeld: Skript erst bei "JA" ausgeführt wird

Hallo zusammen,

ich habe dieses Skript erstellt. Nun möchte ich, wenn auf "Ja" geklickt wird die Installation durchgeführt wird. Bedeutet also, dass die letzte Zeile erst bei "Ja" ausgeführt wird und nicht bei "Nein" oder "Abbrechen". Was muss ich einfügen, dass das so funktioniert?

# Show message box popup.
Add-Type -AssemblyName System.Windows.Forms
$Result = [System.Windows.Forms.MessageBox]::Show("Möchtest  installieren? Wenn ja, bist du im neu eingerichteten Benutzerkonto?","Sicherheitsfrage",3,[System.Windows.Forms.MessageBoxIcon]::Exclamation)

If ($Result -eq "Yes")
{
    $a = "Installation wird durchgeführt"
    $a
}
elseif ($Result -eq "No")
{
    $a = "Installation wurde abgebrochen. Antwort Nein."
    $a
}
else
{
    $a = "Installation wurde abgebrochen"
    $a
}
#Ausgabe 
#Ja = "Installation wird durchgeführt"
#Nein = "Installation wurde abgebrochen. Antwort Nein."
#Abbrechen = "Installation wurde abgebrochen"
$wshell = New-Object -ComObject wscript.shell; $Program = "C:\Users\******\Downloads\******\data\Installationen Abläufe\*******.bat";$Process = Start-Process $Program -PassThru; $wshell.AppActivate('********')

Danke im voraus. :)


Viewing all articles
Browse latest Browse all 2314


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>