Page 1 of 1

import module into IDE

Posted: Wed Aug 14, 2013 1:36 pm
by island_guy
I currently connect to our service by:

$cred = Get-Credential
$session = New-PSSession -Authentication basic -Credential $cred -ConnectionUri https://email.loc.org/PowerShell/ -ConfigurationName Microsoft.Exchange -AllowRedirection -SessionOption (New-PSSessionOption -SkipRevocationCheck)
Import-PSSession $session

At this point it imports the module library for my power shell session. And I complete the task..

I would like to use Power Shell Studio to create some simple forms but it does not recognize the cmdlet -GetCSAMailbox mailbox-name@loc.org or others in the library it imports, when I connect.

I assume, I have to import that module into Power Shell Studio in order to have access to these cmdlets. How do I do this?

Please redirect if I am in the wrong place. I like the product and would like to make it my IDE for powershell applications (GUI).

Thank you.

Re: import module into IDE

Posted: Wed Aug 14, 2013 2:01 pm
by davidc
FYI, I moved the post to the Trail Software Questions forum. If you are a licensed user, you can post in the PowerShell Studio Forum.


As for module coloring please refer to the following blog posts:

http://www.sapien.com/blog/2012/10/15/d ... es-part-1/

http://www.sapien.com/blog/2012/10/16/d ... es-part-2/

These articles cover how to get syntax coloring for modules that are not installed locally.

David

Re: import module into IDE

Posted: Thu Aug 15, 2013 5:08 am
by island_guy
David, I followed the two pages and I don't think I explained my situation maybe.

I do not see the cmdlets in PS Studio, even though it seems like a success. I want to make sure you understand my situation. When I connect to our cloud MSOLS as I posted previously, it loads a module of cmdlets. I do not have physical or remote access to any system. So I ran the cacheexport.exe on my local workstation where, I connect and perform my work.

Am I doing something wrong?

Re: import module into IDE

Posted: Thu Aug 15, 2013 8:58 am
by davidc
What PowerShell version and OS are you using?

Note: If the modules are on a remote system, the local instance of the IDE will not know what to color.

If you have these modules locally, check the PowerShell Panel and it should list all the modules that are automatically found by PowerShell. If the module is not in a discoverable location it may not be cached.

David

Re: import module into IDE

Posted: Thu Aug 15, 2013 1:28 pm
by island_guy
Hi David,

I am running PS v3. OS Win7 Maybe, I am asking the wrong question. I am interested in coloring in the IDE but more interested in just working in the active session (form) How do I import or connect via the active FORM? I see that it imports -Module ISE and MSOnlineExtended, how do I import my session when I connect. I currently connect like so:

$cred = Get-Credential
$session = New-PSSession -Authentication basic -Credential $cred -ConnectionUri https://email.loc.org/PowerShell/ -ConfigurationName Microsoft.Exchange -AllowRedirection -SessionOption (New-PSSessionOption -SkipRevocationCheck)
Import-PSSession $session

Thank you.

Re: import module into IDE

Posted: Thu Aug 15, 2013 2:27 pm
by davidc
I see, you were really asking two questions here. The experts in the PowerShell forums are better suited to answer question about sessions and implicit remoting. Just make sure the GUI script is run locally and not remotely otherwise you will not see the GUI. You can consider using Invoke-Command instead as well.

As for the coloring, again the IDE has no way of knowing what modules are on the remote machine, so it is unable to give you color feedback in this instance.

David