PowerShell for Office 365 and Azure AD

jhyiesla
jhyiesla used Ask the Experts™
on
Personally, I think that PowerShell should be called PowerSh**.

There's regular PS and then there's the Azure one and then there's the Exchange management shell that is sort of another PS and who knows, there may be more.

Geez...

So, I've worked my way thru this once before, but have now come up empty in remembering what I did.  I've spent about an hour or so perusing the Internet looking for the commands that have to go in front of the commands that I want to do.  And, of course there doesn't appear to be a single article that outlines exactly the commands. And even when I trace the supposed commands that go before the ones that I need, I usually end up with an error that the command I've just executed isn't a valid command.

So, here are the two commands that I want to ultimately execute:

Get-MSOLUser –UserPrincipalName <UPN of the affected user> | FL | Clip
Get-Mailbox –Identity “User Name” | FL | Clip

I'm trying to track down an issue between on -premise AD and Office 365.

Can you tell me which PS  or PS's I really want to run for these and what commands have to come first in order for these to be recognized?  I'm running these either on a Windows 2012 server or  Windows 10 PC.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Network Consultant / Engineer
Commented:
Open any Powershell prompt and run the following:
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session
Connect-MsolService -Credential $LiveCred

Open in new window

It will prompt for your Office 365 admin credentials and then connect to the service. You should then be able to run those commands.
Perfect, thanx... what it I want to run them against the Azure AD side, or is that even a thing?
Jeremy WeisingerSenior Network Consultant / Engineer

Commented:
MSOL commands only apply to Azure AD. :)
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Thanx...
Top Expert 2016

Commented:
Powershell is infinitely extensible by the use of modules.  If the modules are in your psmodulepath then since powershell 4 they will automatically import.  If you don't like using Powershell to manage things and don't like scripting you are always free to NOT use it and use the gui tools. Scripting gives you repeat-ability.
Jeremy WeisingerSenior Network Consultant / Engineer

Commented:
Glad to help. :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial