Works in ISE but not Console This topic contains 2 replies, has 1 voice, and was last updated by Steve 1 year ago. Author Posts June 5, 2017 at 6:58 pm #72133 SteveParticipant I found this answer on Powershell.org: Script not work on console Is there any chance I can trial and error my way through what's being called to see if I can isolate the problem? If so, any recommendations on how I might go about that? These are my commands: [void][System.Reflection.Assembly]::LoadWithPartialName('PresentationFramework') and Add-Type -AssemblyName PresentationCore,PresentationFramework $Window = [System.Windows.Window]::IsActiveProperty $ButtonType = [System.Windows.MessageBoxButton]::OK $MessageIcon = [System.Windows.MessageBoxImage]::Error $Result = [System.Windows.MessageBox]::Show($MessageBody,$MessageTitle,$ButtonType,$MessageIcon) IF there are other parameters that may affect launching in console I'd love to know. Thanks!!! June 5, 2017 at 8:09 pm #72140 SteveParticipant Actually, I can get the GUI to remain open but I have to use powershell.exe -noexit -File blah Without the noexit, the GUI shows for a fraction of a second just as the console window is disappearing. BTW, I'm not using any taskbar notices. It's just a GUI window with two buttons, a list box and a textbox. Regards, Steve June 5, 2017 at 8:24 pm #72146 SteveParticipant Ok, I got it to work correctly... with a batch script (ugh). powershell.exe -noexit -windowstyle hidden .\foo.ps1 You know I've been running a lot of powershell scripts using batch files with these switches but always after -File blah. Turns out powershell assumes you are running the switch against the file. Move the switches to just after powershell.exe and they behave as they should. So What I get is The console window appears briefly, disappears, then the gui window pops up a few moments later All the functions work. I have another post on here that wasn't completed asking how to run a series of commands after a one button click. I found that answer so I will resurrect that post to answer it. Author Posts You must be logged in to reply to this topic.