cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
herbertkoelman
Active participant

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

Accepted Solutions
herbertkoelman
Active participant

Re: Using dialogs in a powershell script

Jump to 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
Active participant

Re: Using dialogs in a powershell script

Jump to solution

 

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
herbertkoelman
Active participant

Re: Using dialogs in a powershell script

Jump to solution
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
Roman2
Active participant

Re: Using dialogs in a powershell script

Jump to solution

I've found an another example

MessageBox

0 Kudos
rguggisberg
Intrepid explorer

Re: Using dialogs in a powershell script

Jump to solution
0 Kudos
herbertkoelman
Active participant

Re: Using dialogs in a powershell script

Jump to 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