Include scripts in PowerShell GUI project

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Post Reply
User avatar
timstspry17
Posts: 40
Joined: Sun Sep 06, 2015 9:31 pm

Include scripts in PowerShell GUI project

Post by timstspry17 » Tue Sep 17, 2019 6:29 am

Hello, I would like to know if in a PowerShell project you can include other scripts in like the form_load event? I would like to include a couple of scripts in the same directory as my powershell project and have their functions available to the form project like this:

.\getsomeinformation.ps1
.\getmoreinfo.ps1

so on and so forth.

Thanks!
Tim

User avatar
jvierra
Posts: 13793
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Include scripts in PowerShell GUI project

Post by jvierra » Tue Sep 17, 2019 11:01 am

Yes. Have you tried this in your form? Any scripts or modules can be loaded.
You need to use the script home folder and use the full path to the script.

User avatar
timstspry17
Posts: 40
Joined: Sun Sep 06, 2015 9:31 pm

Re: Include scripts in PowerShell GUI project

Post by timstspry17 » Wed Sep 18, 2019 4:14 am

Thank you for this information. Yes, I had tried it in my form project, but didn't use the full path to the scripts. This information is helpful, thanks so much!

Tim

Post Reply