Don’t forget about PowerShell




August 27, 2012 —  (Page 2 of 2)

You may be saying, “But Shane, I am not an administrator or developer, why do I care about this?” Because you are the type of person who is reading this article. You aren’t some slacker; you care about growing your skillset and are interested in all things SharePoint. Let PowerShell be your gateway to understanding more admin topics.

Have you ever wanted to create a list with 10,000 items to test something with? PowerShell can do it. Ever want to move files from the file server to SharePoint and copy over the create date, modify date and owner? PowerShell can do it. Do you have a VM you use to test? Want to be able to fix your own boo boos? PowerShell is your friend. Did you know there is even a Web Part that lets you run PowerShell? I have never used it, but it looks pretty cool.

So don’t give me grief about how you aren’t an administrator or developer, so you have no use for PowerShell. Everyone has a use for PowerShell.

When you take a look at PowerShell, it is real easy to get overwhelmed. There are lots of great scripts and such to use to accomplish tasks, but not a lot of back-to-the-basics stuff. To that end, here are five commands I feel everyone should start with:
• Get-Command
• Get-Help
• Get-Alias
• Get-Member
• Start-Transcript

Once you are an all-star with those commands, then you can really start to build out your knowledge. From there you will need to learn about |, aka “the pipe.” You will also look at loops, with the ForEach-Object loop being the most popular. I have taught classes on all of this stuff, so I have never looked for a good resource. There are plenty of websites and books; do a little digging and find one that speaks to you.

With the basics well in hand, you can finally follow along with all of the chaos presented on those scripts on the Internet. My favorite place to look at SharePoint scripts is get-spscripts.com: clever name and clever scripts. My warning to you though is don’t just run scripts off the Internet on your server. You need to use the skills you learned earlier to dig into each script and understand it first, then test it on a test server. My buddy Todd Klindt has a hilarious story about the difference in PowerShell between two commands:
Get-SPDatabase | Where-Object {$_.Name -eq "SharePoint_Config"}
Get-SPDatabase | Where-Object {$_.Name = "SharePoint_Config"} <-Don’t do this!

One of those finds the database named SharePoint_Config, and the other one renames all the databases in your farm to SharePoint_Config. The moral of the story is that scripts on the Internet can do more damage than good, so learn to read them.

Okay! So we are all now on the same page. Go forward and learn more about PowerShell. Whether you already know lots or nothing at all, the upside is huge. PowerShell is the now and the future, no matter what version of SharePoint you are using. If you have any questions or want to tell me your success stories, tweet me or e-mail me.

Shane Young is a consultant at SharePoint911, a Rackspace company. He can be reached at shane.young@rackspace.com, and on Twitter at @shanescows.

Pages 1 2 


Share this link: http://www.sptechweb.com/link/36901

 
 
This site's content Copyright © 1999 - 2013 by BZ Media LLC, All rights reserved.
Legal and Privacy
Phone: +1 (631) 421-4158 • E-mail: info@bzmedia.com