Join Brian Culp for an in-depth discussion in this video Overview of Powershell for Office 365, part of Office 365: Troubleshoot Availability and Usage.
- [Instructor] Windows PowerShell is too big of a topic to cover in one section of one course, so we'll focus our discussion here and just look at the PowerShell commands that will manage cloud identities, that way we'll make this topic manageable. In fact, there's an entire course on Windows PowerShell available in the course library. And if you're planning on pursuing Windows administration certification beyond Office 365 I would say that that course is required viewing.
Now that said, I'll provide a quick overview here of the PowerShell basics that you should know in order to do Office 365 administration. So here is essentially the big deal about PowerShell and why it comes up so often in the discussion of the Office 365 administration and other Windows Server administration topics. One of the things you can do with PowerShell that is harder to do with the Office 365 Admin Center is bulk admin tasks.
And some of the things that we're looking at in this section here is how to update passwords for lots of users at once, or configure lots of users, so that their passwords never expire. So bulk admin tasks are easier in PowerShell than they are in through the Admin Center. And it's not a big deal if you're doing a test environment with eight users, but that's a huge deal if you're doing a production environment with say 800 users or even more. Another thing you can do is you can do queries against your database of user accounts and you have some filtering flexibility.
What that means is that you can quickly look up the users in a certain group in the Admin Center, but you have some either or queries, so you can find everybody that's in one group and another group, or in one group and that doesn't have a license assigned. So you have some filtering flexibility that you can do with PowerShell. Another advantage of PowerShell is that you can save information that you retrieve to a file. So if you just want a list of your users, for example, you can certainly pull it up and look at it on the screen in Office 365's Admin Center, but with PowerShell you can save it all to a file and then you can hand that file to some other department in the company that needs just a list of all of the users, or a list of all of the users who are in the billing department.
And then finally, you should know, especially when it comes to Office 365, that there are certain exclusive administration tasks that can be done through PowerShell that cannot be done through the Office 365 Admin Center. So those are the main advantages of PowerShell and why Microsoft especially puts so much emphasis on PowerShell commands in terms of administering an Office 365 environment. Now what's more, everything in PowerShell is what I refer to as recipe-based.
The memorization part comes with learning the general syntax of a PowerShell command. So let's take a look at it now. The general syntax of every PowerShell command will look essentially like this, there will be a verb, there will be a noun, and there may or may not be variables. The verb says we're going to do something, the noun says who we're going to do it to, or what we're going to do that action to, and then the variables control the mechanisms of that action. So for example, some common verbs that you'll come across in Office 365 administration include Get, get a list of users, Set, set a variable or set a property of an account, Remove, Add, Enable, Disable.
Now most of those are fairly self-explanatory. Noun examples will look like this, MsolRoleMember, AadrmSuperUser. So we're getting a list of the MsolRoleMembers who have in the variable arguments these roles, for example. So again, the PowerShell syntax can look a little overwhelming, because of the verbs and the nouns and the variables, it can make for a very long command, but if you break it down and you know what you're looking at, you know that you're looking at the verb first, then the noun, and then the variables, it's actually not that hard to decipher what that PowerShell syntax is trying to do.
So once again, the variables will specify a particular user or a particular group or a search string or a setting. And we'll see that as we continue on. The other thing about PowerShell that you should know with Office 365 is that it has modules. So PowerShell modules can be used to extend the functionality of PowerShell. A module is a collection of cmdlets, it also includes help files, and sometimes sample scripts.
So some examples of PowerShell modules are these, there is an Azure Active Directory PowerShell module, there's a Skype for Business, there's an Exchange. Now the Azure Active Directory and Skype for Business, for example, you would download and install those modules in order to extend the functionality of PowerShell, so that you could do Azure Active Directory administration tasks with PowerShell. The Exchange, as you can see, no download is required, it's pushed upon connection.
So here is what is generally going to happen when you use PowerShell and Office 365. If you just open up PowerShell and start typing in some of these commands that I'm talking about it won't work, there are some requirements that go into using PowerShell to do your Office 365 administration. So the general flow will look like this, you will first install the Microsoft Online sign on Services Assistant. And that is something that will just allow you to make the connection to your Office 365 tenent.
Then you will install the Azure Active Directory module. This includes a lot of cmdlets that are used to do the Office 365 administration, some of which, as I said, we will look at in this section. And then finally, you will use the cmdlet to perform the task. So once you have this basic vocabulary kind of as a foundation then all of the rest of it just is really a matter of looking up the recipe, cutting and pasting the syntax, in a lot of cases there is a lot of samples in order to give you a starting point, and you can just replace some of the variables that are in the samples that you would look up when you are looking up the recipe, and then entering it into a PowerShell command prompt.
So those are the basics of PowerShell. Understanding this foundation when it comes to Office 365 will put you in good standing for learning all of the PowerShell related topics that you need to learn in order to successfully complete the 70-346.
- Navigating the Office 365 reports dashboard
- Generating and interpreting usage, email, and auditing reports
- Generating and interpreting mail protection and mail hygiene reports
- Showing and hiding user-level detail information in reports
- Understanding the service health dashboard
- Monitoring Office 365 Health
- Retrieving data with the Management Pack
- Using PowerShell for Office 365
- Creating a service request
- Using the Remote Connectivity Analyzer, the Connectivity Analyzer tool, and the free/busy troubleshooter