New-ExoPSSession not being recognized as a cmdlet

Ask your 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.
This topic is 4 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
Marcel_StJean
Posts: 2
Last visit: Thu Feb 03, 2022 8:47 am

New-ExoPSSession not being recognized as a cmdlet

Post by Marcel_StJean »

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
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: New-ExoPSSession not being recognized as a cmdlet

Post by jvierra »

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
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: New-ExoPSSession not being recognized as a cmdlet

Post by davidc »

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 4565 times
David
SAPIEN Technologies, Inc.
Marcel_StJean
Posts: 2
Last visit: Thu Feb 03, 2022 8:47 am

Re: New-ExoPSSession not being recognized as a cmdlet

Post by Marcel_StJean »

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
This topic is 4 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked