PowerShell GUI

Hey all,

So I am busy trying to develop a GUI interface for a script, that when run on a users machine it will locate and display all the PSTs on their machine. From there it was meant to be copied to a server, where the process to import to Azure storage would begin.

The 1st issuae i am having, is getting the actual button on the GUI to work. The idea is when you click it, the script starts in the back ground, gathers all the results and presents them onscreen.

Once this is working, what i was planning on doing, was add a check box so that the user can decide which PSTs would be copied to the server. I havent gotten to this point yet.

Initially i just had the script looking at the E: drive, instead of finding all the drives on a machine and scanning.


Hi Recco,

Could you please tell us what currently happens when you press the button?


delete everything under # Load XAML Objects In PowerShell

# Load XAML Objects In PowerShell
$xaml.SelectNodes("//*[@Name]") | %{Set-Variable -Name "WPF$($_.Name)" -Value $Form.FindName($_.Name)}


write-host 'buttonclicked'


$Form.ShowDialog() | out-null

When clicking the button, i wanted it to start the Get-PSTFinder function and then present the answer in the field below the button.

Thanks that works perfectly! I have adjusted the code so that my function can run, which works. In the meantime i was doing some research on how to find the PST files currently attached to outlook, using ComObjects, which works. So now what i am attempting to do now is find the attached PST, make a copy on the server and then remove the PST from outlook.


If you can detect only the PST’s you need, then why even have a GUI? If you still want to use a GUI, consider collecting the PST information when the form starts, especially if you are using a direct COM method to get the PST’s versus a long search. Here is an example that is a good starting point and shows how to fill a listbox as well: Creating Pop-ups by Using PowerShell - Scripting Blog

Valid point, but i really want to get this right (having never done it before) and i think showing the users which files will be affected is a good idea.

Thanks for the link!