cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
herbertkoelman
Level 4

Using dialogs in a powershell script

Jump to solution

I'm display error messages using dialog bowes.

function error_message([string]$message){    
    [System.Windows.Forms.MessageBox]::show("$message", 'CTSS Installer','Ok','Error')
    return $message
}

error_message "something went very wrong here ..."

The dialog box is displayed,  but it's hidden by installshield's progress window.

Is there a way to have my dialog being always displayed on top of the installshield window ?

Labels (1)
0 Kudos
(1) Solution

Now this time it worked.

In powershell, I use this function to popu dialogs.

function error_message([string]$message){
    
    trace-info "ERROR_MESSAGE: $message"
    
    $wshell = New-Object -ComObject Wscript.Shell
    $wshell.Popup($message,0,"CTSS Installer - Error",0x1000)
    
    return $message
}

I'm using an undocumented nType 0x1000 (4096) instead of 0x0.

View solution in original post

0 Kudos
(5) Replies
roman2
Level 7

 

Alternatively, if you want to show a msgbox use script:

$wshell = New-Object -ComObject Wscript.Shell

$wshell.Popup("Show here error description",0,"Error",0x0)

=======================================================

 

 

 

0 Kudos
I've changed my code and used your suggestion (which by the way did a better job then what I did 🙂 ).

Yet the message popup is still hidden by the InstallShield window.

Maybe it's the wrong approach. Is there a way to let install shield display the error message. Is there such a property that can be set in a powershell script with set-property ?
0 Kudos

I've found an another example

MessageBox

0 Kudos
rguggisberg
Level 13
0 Kudos

Now this time it worked.

In powershell, I use this function to popu dialogs.

function error_message([string]$message){
    
    trace-info "ERROR_MESSAGE: $message"
    
    $wshell = New-Object -ComObject Wscript.Shell
    $wshell.Popup($message,0,"CTSS Installer - Error",0x1000)
    
    return $message
}

I'm using an undocumented nType 0x1000 (4096) instead of 0x0.

0 Kudos