Get started with PowerShell and SharePoint Online

Doctor Scripto

Summary: Microsoft PFE Chris Weaver talks about getting started with Windows PowerShell and SharePoint Online.

Welcome back Chris Weaver as guest blogger. You can see his previous guest blogs.

Christopher Weaver is a Microsoft Premier Field Engineer (PFE) who focuses on SharePoint and Office 365 solutions for large enterprise Premier customers. He has been doing PowerShell and SharePoint with Microsoft for nine years. In his spare time, he enjoys backpacking, hiking, kite surfing, and spending time with his kids and dog. You can follow him on his blog.

Hello All,

I’ve put the kids to bed, the dog is snoring on the couch, and I am thinking about a conversation I had earlier today with one of my customers. He is currently planning to migrate SharePoint 2010 and SharePoint 2013 farms from on-premises to the cloud. The project had a few points to follow:

  • Start by moving ~13.5 TB of data
  • Move site collections from on-premises to the cloud
  • Maintain current budget (in a perfect world)

The current field of migration options to SharePoint Online have three choices, but really only two are popular or regularly used.

  1. Microsoft partner tools

There are several popular ones, which I can’t name, but do a quick Internet search, and I think you will figure it out.

  1. FastTrack team, which is a team here at Microsoft to help customers get their data into the cloud.
  2. PowerShell

There are cmdlets to manage site collections, tenant, and an API to perform upgrades to the cloud.

As you can imagine, the first two options are the most popular because they use a prepared product or let somebody else do it. There are some definite pros and cons to each choice. The FastTrack and PowerShell options can only move list or libraries. You have to create your site collections, webs, and other SharePoint objects, which provides a possible cost savings. Although partner tools work and essentially come with a built in process, they can be expensive. This choice reminds me of a saying. “You can have only two of the following: cheap, well done, or fast, so choose wisely.”

Because I’m writing for Hey, Scripting Guy!, I think we all know which direction we will be going. I plan to write several articles to explain how you can migrate all your data and recreate the site collections and webs. In this article, we will start at the beginning and work our way through connecting to the SharePoint tenant. Here are the system requirements to work with SharePoint Online.

Windows Management Framework 3.0

Note: This is a minimum. It will work on a machine with versions 4 or 5 of Windows Management Framework.

Now that you have a machine to work with, you need to open PowerShell and connect to your SharePoint tenant. To open PowerShell, you can open the regular PowerShell command window or import the SharePoint Online module as I have in the following screenshot.

Screenshot that shows imported SharePoint Online module.

Note: You can safely ignore this message.

If you open the SharePoint Online Management Shell, this essentially opens PowerShell and imports the module for you by using a special profile. Either way you do it, you are now ready to start to manage SharePoint Online.

Now if you run Get-Command -module Microsoft.Online.SharePoint.PowerShell, you should see something like this:

Screenshot that shows result of running Get-Command -module Microsoft.Online.SharePoint.PowerShell.

If you do see this, there is one last step before you can manage tasks like site collection creation, deletion, or administration.

Before we can manage site collections or the SharePoint tenant, you will have to connect to your tenant. To connect you use the Connect-SPOService cmdlet, which requires two pieces of information from you.

  • URL

This is the Admin center URL and, in my case, that is https://mod499144-admin.sharepoint.com.

If you don’t know your URL, go to https://portal.office.com, sign in with your admin account, go to the App Launcher where you should find the Admin app, and click on the app.

Admin app.

On the left side of the page, you will see the Admin Center icon. Select it, and select SharePoint. You will then go to the Admin Center where you can copy the URL from the browser.

Screenshot of the Admin Centers.

  • Credential

This is the username of your administrative account, and the account needs to be a Global administrator. In my case, that is administrator@mod499144.onmicrosoft.com, although yours might be something like admin@contoso.com.

- Screenshot of the Connect-SPOService command and options.

You will be prompted for the password so go ahead and enter that….and, no, I won’t tell you what mine is.

Note: You can only connect to one tenant at a time. If you run Connect-SPOService again, you will disconnect from your current service and connect to another service.

When you’re done managing things and if you want to keep things secure, you need to close the connection to your tenant so you’re going to want to run the Disconnect-SPOService command. The account that runs this command needs to be a Global administrator.

Screenshot of the Disconnect-SPOService command.

Note: Closing the connection to the service does not stop long running processes like a migration.

That’s it for today. I know we are starting slowly, but you need to learn to crawl before you can start sprinting. In my next article, I plan to take you through managing tenants.

Thanks Chris, for sharing your time and knowledge. I look forward to seeing your next article in this series.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. Also check out my Microsoft Operations Management Suite Blog. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy

 

0 comments

Discussion is closed.

Feedback usabilla icon