Powershell on the Way to Work–Part 1

I’ve heard from many IT Pros who want to learn Powershell.   They want to because they need to.   All the new technology revolves about Powershell.  Many vendors are beginning to adopt Powershell as an automation solution.

But just where do you start?

Let’s start at the beginning.   An Introduction.   My friends, this is the Powershell Console

image

Powershell, please say Hello to everyone out there.

image

Ok yes… that was silly but that is your first introduction to Powershell.  It is a Shell just like CMD.EXE was a Shell.  It can accept simple commands.  Just like ECHO was a simple command.   That is the direction we’ll try to go with.

You’ll hear a lot about how Powershell is a new Scripting Solution, it can manage Active Directory, it can (if you teach it apparently) tie your shoes.   But for the ITPro you don’t need to know ANY of that just to use Powershell.

Key word in there… SHELL.  We used to do a lot in the Shell before we had the GUI, there was much we did in the Shell AFTER we had the GUI.   So what we have here is a new Shell.  For me personally I consider it a Management Shell.  I do many day to day tasks with Powershell.   Sometimes it makes more sense to leverage a tool in the GUI.

But to use it, I didn’t really have to sit down for days and learn it.  I just picked up some simple Cmdlets I needed to aid me in my job as a Network Administrator when I started with Powershell.

First off, what is available?

There is a massive amount of Commands here referred to a Cmdlets (Pronounced CoMmanD-LETs) which all follow a simple VERB-NOUN structure.   You will have options like

DISABLE-ADACCOUNT

GET-CONTENT

EXPORT-CSV

Many of them are written to just make sense out of the box.  These are actual features that can be accessed from Powershell.  Imagine being able to easily UNLOCK a user account or DISABLE a computer?  Maybe even find files buried in the filesystem. This is what I use Powershell for. 

To get a list of available Cmdlets in your Powershell console key in

GET-COMMAND

Of course your eyes will buzz out of your head with the rows pouring on the screen.   But just like in the world of CMD.EXE our friend “MORE” is still there to help

GET-COMMAND | MORE

That will let us step through and view the pages full of Content.  Just like in DOS and CMD.EXE.   You’ll three different types, Alias, Function and Cmdlet.   We’ll talk about the differences next time.  But for now We’ll change the GET-COMMAND to only show us Cmdlets.

GET-COMMAND –type Cmdlet | MORE

image

Nice.   Only Cmdlets to see.   Less to confuse us with a smaller pile.   Where do you start?  Believe it not.  Just try typing in a Cmdlet to see what it does.   All of the Hotkeys you had in CMD.EXE still work too.  CTRL-C is still your best friend.

But how did I find out how to work “GET-COMMAND” ? What if I want bigger letters?  What if I don’t like Blue?  What if I want to customize the console?

All of this and more when we return.  Time for me to head out of the car and get to work.  I’ll see you soon.

DSC_0158 (640x425)

Sean Kearney
Twitter:  @energizedtech
www.powershell.ca