New-ExoPSSession not being recognized as a cmdlet

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
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.
Locked
Marcel.StJean
Posts: 2
Joined: Thu May 23, 2019 6:23 pm

New-ExoPSSession not being recognized as a cmdlet

Post by Marcel.StJean » Tue Jun 11, 2019 8:09 am

PowerShell Studio Product: PowerShell Studio 2019 (32 Bit)
Build: v5.6.163

OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.16299.0
===================================================
Hi folks,

I'm a new PowerShell Studio user, but not a stranger to PowerShell scripts.

I have a function with an '$AzureAD = Connect-AzureAD' call that works and loads the required data to the form's objects, etc.

The problem is that (unlike the same GUI code in PowerShell_ISE) I can't create/pass the MFA session to 'New-ExoPSSession'.

1 - i'm prompted to login again... which doesn't happen when running the same commands in PowerShell_ISE, the session simply imports in the background.
2 - although prompted for credentials, the cmdlets work, but not recognized in the PowerShell Studio editor - wondering if that's why 1 above occurs...

I'm thinking it has something to do with scope or setting the session as some sort of global variable... but just can't seem to find what it is.

Thanks in advance for your help!

Marcel

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

Re: New-ExoPSSession not being recognized as a cmdlet

Post by jvierra » Tue Jun 11, 2019 8:35 am

You should not install 32 bit PSS on 64 bit OS. Remove it and install the 64 bit version.

There are numerous issues with Azure CmdLets when run in a form. Also MFA causes issues with authentication. There are methods used to persist a set of credentials. You may also have to use an account that duos not have MFA enabled.

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: New-ExoPSSession not being recognized as a cmdlet

Post by davidc » Tue Jun 11, 2019 8:56 am

PowerShell Studio (32 bit) will still run 64 Bit scripts. You have to select 64 bit from the Ribbon->Home->Platform:
Platform Settings.png
Platform Settings.png (12.98 KiB) Viewed 1892 times
David
SAPIEN Technologies, Inc.

Marcel.StJean
Posts: 2
Joined: Thu May 23, 2019 6:23 pm

Re: New-ExoPSSession not being recognized as a cmdlet

Post by Marcel.StJean » Tue Jun 11, 2019 11:23 am

UPDATE:

Ends up the issue was the scope of the variables, i.e. needed to set the Azure session and relevant vars globally. MFA works fine, importing EXO session as well, etc.

Marcel

Locked