Page 1 of 1

New-ExoPSSession not being recognized as a cmdlet

Posted: Tue Jun 11, 2019 8:09 am
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

Re: New-ExoPSSession not being recognized as a cmdlet

Posted: Tue Jun 11, 2019 8:35 am
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.

Re: New-ExoPSSession not being recognized as a cmdlet

Posted: Tue Jun 11, 2019 8:56 am
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 4568 times

Re: New-ExoPSSession not being recognized as a cmdlet

Posted: Tue Jun 11, 2019 11:23 am
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