I hope I haven’t missed something elsewhere. I’ve been connecting to office 365 - exchange online with a standard PowerShell script ps1, but felt it would be nice to have the same as a module. So I created a module “Office365Exchange” with two functions “Connect-Office365” and “Disconnect-Office365”. After I connect, I find I can’t run for example get-mailbox, I’ve finally discovered that I can if I run Import-PSSession against the variable I created for the new session "$Global:OfficeSession.
Can anyone tell me why the Import-PSSession in my Process block doesn’t return to the shell? And how I might be able to return it? Otherwise I’m thinking I’ll add:
Write-Warning “Now type Import-PSSession `$Global:OfficeSession”
so that I don’t forget I need to Import the session again. I was really hoping I could do it as a single step.
FYI, I’m running Windows 7 with PowerShell v3 installed.