Page 1 of 2

How to make PowerShell Studio import custom modules?

Posted: Mon Jun 12, 2017 8:37 pm
by amloessb
Product, version and build: PowerShell Studio 2017 (5.4.140.0)
32 or 64 bit version of product: 64-bit
Operating system: Windows 8.1
32 or 64 bit OS: 64-bit

I'm trying to get PowerShell Studio to load some custom modules (.psm1) that I use in a lot of my scripts, so that PrimalSense will be aware of the functions/parameters/etc.

I have done the following in order to attempt to make this happen. (Still can't post images; copy and paste the links to view them.)
  1. Home > Platform > Edit Cache
    https://i.imgur.com/nFrQlCu.png
  2. Import my module, make sure it appears and is checked in the list, build the cache
    https://i.imgur.com/qJ6Nzzo.png
But the functions I have defined there are still showing up as unknown:
https://i.imgur.com/icm2p5I.png
How do I make PowerShell Studio aware of custom module files that I have written?

Thanks.

Re: How to make PowerShell Studio import custom modules?

Posted: Mon Jun 12, 2017 8:53 pm
by Alexander Riedel
If you updated your module without increasing the version number it will not be re-imported because it thinks it is already cached.
So either delete the module first and then import it again or increase the version number when you make changes to your module.

Re: How to make PowerShell Studio import custom modules?

Posted: Mon Jun 12, 2017 8:57 pm
by amloessb
This is the first time I have ever tried to import the module, and none of its functions are recognized by PrimalSense, so the version number is irrelevant.

Re: How to make PowerShell Studio import custom modules?

Posted: Tue Jun 13, 2017 12:19 am
by Alexander Riedel
In that case please provide some more information about your module. Is it exporting functions? Classes?
Are none of the functions in your module visible? Can you see the module and its functions in the Object browser?

Re: How to make PowerShell Studio import custom modules?

Posted: Tue Jun 13, 2017 1:53 pm
by amloessb
Functions only. One of the functions uses a class via Add-Type as part of its execution, but there are none other than that.

I can see the module itself in the object browser, but clicking the arrowhead to expand it does nothing:
https://i.imgur.com/bCslPDH.png
The normal way that I use this module in my scripts is to just run
Import-Module Path\to\Common-Commands.psm1

Re: How to make PowerShell Studio import custom modules?

Posted: Tue Jun 13, 2017 2:47 pm
by Alexander Riedel
Is it possible for you to send us this module for evaluation?

Re: How to make PowerShell Studio import custom modules?

Posted: Tue Jun 13, 2017 3:35 pm
by amloessb
I can't send you that specific module since it contains proprietary code that I can't share, but I can provide a second module that is exhibiting the same behavior. What would be the best way for me to do so?

Re: How to make PowerShell Studio import custom modules?

Posted: Tue Jun 13, 2017 4:11 pm
by Alexander Riedel
Please upload it here and reference this thread: https://www.sapien.com/support/upload

Re: How to make PowerShell Studio import custom modules?

Posted: Tue Jun 13, 2017 4:14 pm
by amloessb
Uploaded. Thanks.

Re: How to make PowerShell Studio import custom modules?

Posted: Tue Jun 13, 2017 9:40 pm
by Alexander Riedel
There is no manifest with this module?