Powershell – Part 1
November 10, 2009
Posted by on
Start at the beginning. Powershell can be run via:
Say hello to your new blue and white friend. My hope is to build from post to post and teach what I learn day-to-day as I attempt to migrate from perl scripts to powershell.
Powershell retains the commands that are available in most shells like csh, bash, korn, or DOS. In an effort to attract both *Nix and Windows users powershell is chock full of aliases that will be familiar to both flavors of the IT world. Commands like dir and ls produce the same results, but in reality they are just aliases to a cmdlet called Get-ChildItem. Try typing all three commands in powershell, and you will see that they produce the same results. In order to see a list of all the available aliases try:
This is a great place to start and look at some of the more common commands, but there’s an even more important resource that you need to become familiar with immediately: get-help, man, or just help (mind you help is a function that is equal to get-help, while man is an alias to help). Let’s look up the help page for get-alias:
Using this we can see everything we need to know about how to look up, and get information about configured aliases in your environment:
get-Alias -definition get-ChildItem
get-Alias -definition get*
You’ll notice that one lesson Microsoft learned is to provide proper inline documentation the way *Nix and Perl do. This beginning should provide as a confidence booster that they may have done some things right. I can tell you for certain that there are a lot more surprises in store for you, but we’ll save that for another day. At least you now have a few resources you can use to start learning the ins and outs of Powershell.