Dot Net Mafia

Group site for developer blogs dealing with (usually) .NET, SharePoint 2013, SharePoint 2010, Office 365, SharePoint Online, and other Microsoft products, as well as some discussion of general programming related concepts.

Kyle Kelin on .Net

PowerShell: My First Look

Even before the details of SharePoint 2010 were announced I’ve been wanting to learn PowerShell. Of course now that SP2010 is relying on PowerShell almost entirely I have extra motivation to learn the tool. I thought what I would do in this post is document step by step what I did to get familiar with the tool. Readers new to PS can follow along to help them get started.

I first went to this link and downloaded the PowerShell cheat sheet here . This way as I learn commands I don’t really have to remember them.

After fixing some printer issues I read this article from James Kovacs here

The paragraph below gives you a basis for how PowerShell commands are structured:

Believe it or not, you probably already know a fair amount of PowerShell. Many of the commands you’re familiar with in cmd.exe work in PowerShell. (More surprisingly, many of the common commands you know from bash, tcsh, or other Unix shells also work!) The command line arguments are often different, but the basic familiar commands are there. So try out dir, cd, copy, del, move, pushd, popd, … (If you’re a old Unix hacker, you can try out ls, man, kill, pwd, ps, lp, cp, … Unfortunately there is no grep equivalent built in, which is terribly unfortunate.) All of these commands are actually aliases to PowerShell commands, which are named by VERB-NOUN, where NOUN is singular. For example to get a list of running processes, you run Get-Process, which is aliased to “ps”.

PowerShell is very conducive to experimentation. You can always find out more about a command or alias typing “Get-Help [CmdName|Alias]” or simply “help [CmdName|Alias]” since help is an alias for Get-Help. (N.B. PowerShell is case insensitive.) You can also look for commands by typing part of the command and pressing tab repeatedly. For example, if you want to find all set- commands, type “set-[TAB][TAB]…” to display Set-Acl, Set-Alias, etc. You can also look for commands using wildcards. Type “*-Acl[TAB][TAB]…” displays Get-Acl and Set-Acl.

After that I watched Hanselman’s PowerShell tutorial on DnrTV. After that I immediately installed PowerTab. This tool adds intellisense to PS which is a huge help. Best part is it is free.

Since my main reason for learning PowerShell was to use it with SharePoint the final step was to read this article by Corey Roth which shows you how to load up the SharePoint PowerShell commands.


No Comments

Leave a Comment


About KyleKelin

Kyle Kelin has been implementing software in the Microsoft space for the past 6 years mainly as a consultant. His interests are SharePoint, .NET, JQuery, and Silverlight.
2012 dotnetmafia.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems