PowerShell for Office 365 and Azure AD

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.
LVL 28
jhyieslaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeremy WeisingerSenior Network Consultant / EngineerCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jhyieslaAuthor Commented:
Perfect, thanx... what it I want to run them against the Azure AD side, or is that even a thing?
0
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
MSOL commands only apply to Azure AD. :)
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

jhyieslaAuthor Commented:
Thanx...
0
David Johnson, CD, MVPOwnerCommented:
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.
1
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Glad to help. :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.