PowerShell GUI

This topic contains 6 replies, has 4 voices, and was last updated by Profile photo of Recco Bucceri Recco Bucceri 3 months, 3 weeks ago.

  • Author
    Posts
  • #54595
    Profile photo of Recco Bucceri
    Recco Bucceri
    Participant

    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.

    • This topic was modified 3 months, 3 weeks ago by Profile photo of Recco Bucceri Recco Bucceri.
    • This topic was modified 3 months, 3 weeks ago by Profile photo of Recco Bucceri Recco Bucceri.
    • This topic was modified 3 months, 3 weeks ago by Profile photo of Recco Bucceri Recco Bucceri.
  • #54599
    Profile photo of Recco Bucceri
    Recco Bucceri
    Participant

  • #54605
    Profile photo of Liam Fisher
    Liam Fisher
    Participant

    Hi Recco,

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

    Liam

  • #54624
    Profile photo of Dan Potter
    Dan Potter
    Participant

    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)}
     
    
    $WPFbutton.Add_Click({
    
    write-host 'buttonclicked'
    
    })
    
    
    $Form.ShowDialog() | out-null
    
    
    • This reply was modified 3 months, 3 weeks ago by Profile photo of Dan Potter Dan Potter.
    • This reply was modified 3 months, 3 weeks ago by Profile photo of Dan Potter Dan Potter.
  • #54655
    Profile photo of Recco Bucceri
    Recco Bucceri
    Participant

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

    @Dan
    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.

    https://gist.github.com/Lothyza/8863cabe2eda6e499a134a15f9cb0332/85d84d7b5eb92dc670689e24689be678ab0af897

  • #54656
    Profile photo of Rob Simmers
    Rob Simmers
    Participant

    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: https://blogs.technet.microsoft.com/heyscriptingguy/2015/11/02/creating-pop-ups-by-using-powershell/

  • #54658
    Profile photo of Recco Bucceri
    Recco Bucceri
    Participant

    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!

You must be logged in to reply to this topic.