Last Update: Sep 04, 2024 | Published: Dec 07, 2016
What I have found is that most people who still have not learned embraced PowerShell say they aren’t doing so because they think it is for the other guy. If you are an administrator, you say it is a developer tool. If you are a developer, you say it is an administrator tool. And if you are a site collection administrator you say meh. However, PowerShell is for EVERYONE!
The next section is all about convincing you why you should love PowerShell. If you don’t need convincing, then you can skip below to the section titled What Are the Basics You Should Know?
Because I said so and everything you read on the internet is true. Here is the easy test to discover if you should learn PowerShell:
I don’t think the flowchart can be any clearer — if you are going to continue to work with platforms in the Microsoft ecosystem, then PowerShell is an important part of your future.
PowerShell’s rise to dominance in the Microsoft world is because everything is easier and more flexible with PowerShell. Think about that new feature you want to see Microsoft add to SharePoint. There are two ways for the company to release the feature — as a new page in Central Administration or as a cmdlet in PowerShell. To make a new page in Central Admin takes a lot of work and testing. Central admin supports 50 different languages at last count, meaning that new page has to be written, translated, and tested in 50 different languages. Do you know how many languages PowerShell supports? One. So the next time you are annoyed that the task you want to do is only in PowerShell, now you know why. And this holds true for all of Microsoft’s products. That is why with every release you see more “cool” features that are found only in PowerShell. And because I know you like hanging out with the cool kids, you are going to have to embrace PowerShell to stay relevant.
Last point here because I want you to embrace PowerShell wholeheartedly. Go to your favorite job board and search for PowerShell or DevOps. That is where a lot of the technology jobs are headed, and while I am not saying you should head there, I am saying the more skills that you have that lend themselves to automation, the more employable you are. And because you didn’t select that you are going to win the lottery in the flowchart, a good job is a nice thing to have.
PowerShell works with all modern SharePoint versions, both on-premises and online. So, SharePoint 2010, 2013, and 2016 all work and come with the SharePoint Administrator Shell, which is PowerShell for SharePoint ready to go. Just make sure you always run it as an administrator.
SharePoint Online, and all of Office 365 for that matter, support PowerShell. You just have to manually install it on your system to get it up and running. To install it, you can either follow along on a boring Microsoft website or, because we are friends, I have made you a video that shows you how to install PowerShell for SharePoint Online and Office 365. I will let you pick which one you want to use to get things up and running.
Would it be hyperbole if I said everything? I don’t think so but just to be safe, I will provide more details.
This is a lot like the earlier paragraph about who is PowerShell for, in that it can do things for everyone. Although it seems that everyone knows you use PowerShell to install and configure SharePoint, a lot of people don’t think about the fact you can also use it to create, edit, configure, and delete content. The following are just a few examples of what you can do with PowerShell:
The possibilities are endless. It is very empowering when you get those bizarre, ridiculous requests from users and you realize that yes, you can write a PowerShell script to upload all of the documents from their desktop to their My Site and tag them with the original create and modify dates with metadata derived based on the color sweater they are wearing. Who needs a third-party tool? However, before you do anything that crazy, you need to learn the basics.
I have had the good fortune of helping thousands of people learn PowerShell over the past six years or so, and I always start in the same place. Learn these basic cmdlets and you will be all set. Learn these cmdlets and you can figure out the rest.
Wow, are you exhausted? I hope so; that means you are learning. The good news is now that I have made you read and learn that way, I am going to reinforce it with video. I am such a good friend. You can either learn with the video PowerShell Intro without SharePoint context, which makes it easy to do from your local PC or you can watch Get Started with PowerShell for SharePoint On-Prem to learn in a more comfortable environment. In a later article, we will take a deep dive into getting started with PowerShell for Office 365, but there is a video if you aren’t the patient type. Be warned, though, that video doesn’t teach you the basics like the other two. You will need to watch it after you have learned more about the core cmdlets.
Hopefully, this article has gotten you excited to learn more about PowerShell. In the next article, we will explore how to manipulate objects in PowerShell, which means we will write one of those fancy scripts and make it all make sense. Something roughly like the following, plus any twists I decide to add while I am writing:
Get-SPDatabase | %{$db=0} {$db +=$_.disksizerequired; $_.name + " - " + $_.disksizerequired/1mb} {Write-Host "`nTotal Storage (in MB) =" ("{0:n0}" -f ($db/1024/1024)) -backgroundcolor magenta }
After that, we will look at fun things such as how to create and edit SharePoint lists and their items. I hope you are looking forward to it because I know I am! In the meantime, if you need any help, you can always hit me up on Twitter @ShanesCows or check out the PowerShell resources on the Petri IT Knowledgebase. With all of that knowledge, you can get real fancy.