Troubleshooting Office 365 and PowerShell: Initial Commands with PowerShell - Part 2

In my last post, I mentioned that I would cover some basic tasks that you can do through Microsoft PowerShell that can't be accomplished through the Office 365 administrator console. The Office 365 administrator console does a lot of what customers need to get done such as add users, create groups/aliases, assigning licenses to users, setting up policies and rules, etc. But, there are a lot of bulk actions that require the use of PowerShell to get done.

On a Windows computer, PowerShell should already be available to you. You would run it as an administrator by searching for the application, right click on it and then select “Run as Administrator.” If you are not the administrator on the computer, you may need the credentials of the administrator in order to do so. I find that a lot of small or medium sized business customers are their own administrator.

The PowerShell command prompt will display after doing the above. Once it does, let's start with the basics.

Initial Commands

The first thing you need to do is connect to your account. You can not create users unless you are logged into the Office 365 administrator console with your credentials, and the same goes when utilizing PowerShell. To verify your account, you would type this into your PowerShell instance:

$UserCredential = Get-Credential

Now that you are verified, you need to have a connection to the services. This is what allows you the ability to make any commands at all to your account. Type this into the PowerShell instance:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Now that you are verified to your account and connected so that you can run commands, you need to mention what type of commands you are going to be using. Use the following command in order have the system know which commands you will be using:

Import-PSSession $Session -DisableNameChecking

Now you’re connected and you can run some basic commands. To check that you are verified, connected and able to run commands, you can type in the following command to get a list of all the mailboxes set up on your tenant:

get-mailbox

Although you can do a lot of commands with the above, sometimes you need to change settings for all the users in your organization at once. In order to make these types of users you would need to connect to the Azure Active Directory. For completing some of those tasks, you would run the command:

connect-msolservice

All these commands will get you in the appropriate place to where you can start doing work. Here are come example of what you can do now: create users, set a global icon picture for your users, set a global signature for all your users, etc. The items that you can accomplish are endless! In my next post, we will go over how to do a bulk change through PowerShell.

What are some things that you would like to see done through PowerShell?

Protect Your Business Data

We are passionate about helping our customers protect their data. We want you to use Jungle Disk to protect yours. Click on Sign Up to get started. It takes less than 5 minutes!

Sign Up