Monday, December 8, 2008

Hello world...

This is my first blog ever; it's dedicated to hard to find facts and explanation regarding Powershell.

I began learning Powershell basically as a complete scripting newbie, I have cut and pasted and manipulated a few VB scripts before beginning Powershell but nothing big otherwise. I am beginning this blog because over the course of my studies I have come across a few sticking points. This Blog will serves as a place holder for interesting and non-apparent facts about Powershell that I come across during my journey to becoming a Powershell Jedi Master :). As it stands for now most posts will be short micro-blog style. The intent of this Blog is to help others along they’re learning path with some of the more unapparent facts and sometime irrelevant yet fun facts regarding Powershell. As such, the skill level of my posts will probably be all over the board.

A little about me: I am a Network Engineer in the Atlanta Georgia Area with 10 Years of Windows Networking Experience. I Passed the MCSE at the ripe old age of 23 in 1999 placing myself in the category of youngest MCSE’s (5% of all MCSE where under 25 at the time, I think, Anyway…).

This will probably be my longest post as I prefer to spend my free time With Friends, Family, or Playing GoW2 on XBL. So without further a due here are a few facts you might not have known about Powershell.

Before I begin with my Obscure tips I must mention the Basics. Powershell is an Object oriented Scripting Language… actually this CAN be my first obscure tidbit. More Precisely Powershell is an automation technology that gets “surfaced” a scripting Language & Shell.

Objects
-------------------
Let’s Say we have an Object of CAR,
A car has parts like Door, in Powershell "Door" would be a property of CAR. The way you use the car like speed, crash or PimpOut would be its methods. Detailed info regarding objects is beyond the scope of this blog (I’m just being lazy, plus Hero’s comes on in 15 min.. yes, I have a DVR, ok I’m just lazy!!)

Anyway, let’s say there is a CMDlet (Pronounced “Command let”) called Get-Car
Putting CMDLets in parenthesis () is the same as assigning them to a Variable



$Car = Get-Car
$Car.Door

is the same as

(Get-Car).Door



One small benefit of assigning Get-Car to a variable would be that you get "Tab Expansion" on the Properties of Get -Car
Which brings me to my next tidbit


Tab Expansion TidBits
------------------
4 Places to use Tab Expansion
(Hitting tab to auto complete a line is called Tab Expansion)

1.) After a variable with a dot
$Date = Get-Date
$Date.[tab expansion]

2.) After a dash in a CMDlet
Get-[tab expansion]

3.) After the Parameter dash
Get-Help -[tab expansion]

4.) If you hit tab when there nothing in front of the prompt Tab Expansion will cycle thru the Child Items or the contents of the current folder and will look like this .\whatever

Bonus Tip: Shift+Tab Cycles thru Tab Expansion Backwards

The Snapin PowerTab (http://thepowershellguy.com/blogs/posh/pages/powertab.aspx) expands the tab expansion function of Powershell to make it act more like Visual Studio IntelliSence

That’s all for now. I hope I made sense please let me know if my examples we’re to simple to complex or Just right.

Until Next Time...


May the PoSH Be with you,
Powershell Jedi

No comments: