The Surly Admin

Father, husband, IT Pro, cancer survivor

Powershell Discovery: Variables

This is true of any programming/scripting language.  Variables are the life blood of what you do.  Without them there is really nothing you can do in a scripting language.  I’m going to assume you know all about variables so I won’t get down to what they are.  But one of the fun things about variables is all the different things you can store in them.  Objects, datetimes, integers pretty much anything can be stored in them these days.  And Powershell has a truly dizzying array of variable types to work with.  Figuring out what you’re dealing with is key to a successful script.  There are a lot of things you can do to an object, but not all objects are created equal!  So some objects will allow you to Convert them to datetime, and others won’t.  How do you find out?

Continue reading

Advertisements

September 25, 2012 Posted by | Powershell - Getting Started | , , , , | 3 Comments

How do you start using Powershell?

I’ve been asked this a couple of times, and to be honest I’m not sure I’m the best person to even ask this question of!  Why? I’m very much a hands on learner, I often tell people that I have to learn with my fingers not with my brain.  What this means is I have to run a script and see how everything works to really understand something.  Reading from a book is all well and good, but it doesn’t “work” for me until I actually sit and try it.  That’s why in my office you won’t find many technical books–and the ones you do find I’ve almost never actually read!

Continue reading

September 24, 2012 Posted by | Powershell - Getting Started | , , | 1 Comment