http://www.sqlservercentral.com/blogs/steve_jones/2013/11/13/powershell-in-a-month-day-1/

Printed 2014/10/24 08:46AM

Powershell in a month – Day 1

By Steve Jones, 2013/11/13

I got started on Learn Windows Powershell 3 in a Month of Lunches at lunch one day. Working at home makes this easy as I have a computer and a kitchen near each other. In this case, a salad, a bowl of chili, and the laptop next to the book to get started. The picture below was post-chili.

20131106_114540

This is the first post in my Powershell challenge. I don’t expect to post every day as I travel, have vacation, etc, but I will post once for each of the days I work on this. At the end, I hope to have a couple PoSh presentations I’ll build as well as more incorporation of PoSh into my talks.

Day 1

I cheated slightly today. I read the first and second chapters here. The first was really a “how to use this book” and the second actually got me started. The first introduces what Powershell is, why it’s good, etc. It’s a good intro, but I’ve been through most of this before, I know something about the environment, and I’ve used it a bit for specific tasks. If you are new to PoSh, read this.

I didn’t get much out of it, so I went into Chapter 2, despite the warning from the book not to do more than one a day. Instead, practice. I made an exception this first day.

The second chapter gets you familiar with how to set up your environment. As it mentioned, PoSh gives you two ways to work with it on most modern OSes. The command line or the Integrated Scripting Environment (ISE). I tend to use the ISE, but you can choose. In this case, I popped both open. One note here, I’m on Win 8 and if I hit the Windows key and type “power”, I see this:

Posh_001

 

There’s no ISE available. This is different on different machines for me. However if I finish “Powershell” and add a space “i”, I get the ISE. Not a bid deal, but an interesting item for me.

Posh_002

The second chapter really goes into getting the environment set up first. Choose large fonts, which is a must for older folks like me. I definitely plan to make this a part of any presentations I do. The chapter also emphasizes that typing matters and accuracy is important. PoSh is case sensitive and different separators, like the various grouping items, matter. These:

([{<

are all different and you can’t mix and match them. Make sure you know the difference. It’s especially try for the single quote (‘) and the backtick (`). Learn the difference.

No scrolling was another important point since you can lose things on the screen. For me, I set the font to 18, left the default colors, and then in the ISE, removed the command window and script editor. That left me full screen with the interactive shell.

Posh_003

 

From there, I played a bit with the way PoSh works. Typing part of commands, and then using Tab or Shift+Tab to cycle through commands. Using these keys to get folders, or parameters, or choices, was handy.

Nothing really executed today, but I did play with various commands to see what happened. The one thing I did run was

Get-Service SQLAGENT

I typed Get-s, hit tab to cycle through choices, and then entered “SQ” and tab’ed to get SQLAgent. That gave me the status of the service on my laptop.

Posh_004

 

That was the basic  learning for today. It’s simple, and a little boring, but it is stuff to know that will make future days easier and build some familiarity with the environments.

Tomorrow, chapter 3.

 


Filed under: Blog Tagged: career, powershell, syndicated
Copyright © 2002-2014 Simple Talk Publishing. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.