User Rating: 3 / 5

Star ActiveStar ActiveStar ActiveStar InactiveStar Inactive
 

Some users may find that their script hangs when using a OpenFileDialog or SaveFileDialog.

The bad news is that scripts which include OpenFileDialogs or SaveFileDialogs and that previously worked on Windows XP may encounter freezing issues on Vista SP1 systems with .Net 3.0/3.5. The affected scripts will hang when PowerShell executes the File Dialog’s ShowDialog function. It’s important to note that this issue is not limited to PowerShell but may affect any other .Net application.

The good news is that there is a work-around for this issue. In order to prevent this problem, you must set the dialog’s ShowHelp property to $True before calling the ShowDialog function. If you are using SaveFileDialog you will also want to set the CreatePrompt and OverwritePrompt properties to $True as well.

$saveFileDialog1 = New-Object System.Windows.Forms.SaveFileDialog
$saveFileDialog1.ShowHelp = $True
$saveFileDialog1.OverwritePrompt = $True
$saveFileDialog1.CreatePrompt = $True
$saveFileDIalog1.ShowDialog() #It is now safe to call this function

 

If you have questions about our products, please post in our support forum.
For licensed customers, use the forum associated with your product in our Product Support Forums for Registered Customers.
For users of trial versions, please post in our Former and Future Customers - Questions forum.
Copyright © 2024 SAPIEN Technologies, Inc.