Powershell – Basic use for the rest of us (Part1)

Ok back to another posting I felt needed saying.   This one might even need a little video later.

One of the things that had me stumped in Powershell initially was the “Where do I go from here?” after you did a GET-CHILDITEM

Well after that, there is a LOT you can do.  But ‘I’m more interested in the pieces.

So in Powershell it pulls down objects.  It’s not really pulling down “Text” as we ITPros think of it.   But let’s put it simpler.   It pulls down a big list.   We don’t really need to know too much about the list.  But it’s a list.  “Objects” or “Things”

There are much better articles to describe the whole theory between objects and C and stuff that’s way headier, so we’ll skip out of that.    By the way, if somebody DOES have a good “Objects for Dummies” link, I’ll edit this article later to reference it

So I run a “GET-CHILDITEM” which by itself pulls up a list of Objects in whatever context we’re presently defaulted to.

Be default in Powershell, you’re in the Context of your Drive structure.  

C:

Or in my case

C:UsersTheEnergizedTech

Running a GET-CHILDITEM shows me this list of Objects (But to us it is a directory structure)

image

Now one of the things I found confusing is I kept thinking “What does GET-CHILDITEM” have to do with the directory?

The answer is NOTHING.  It is just asking for a list of OBJECTS in the current context.   If I were to change the location to the registry (because Powershell) can just as easily navigate the registry Objects it would be the same command.   The output will look different because it’s not pulling down a directory.  Again, it’s just pulling a list of OBJECTS.   Here’s an example of changing to the Registry to view it’s context.

I use SET-LOCATION to change my context in Powershell, to change what part of the system I am presently working in.  So I want to look in the Registry

SET-LOCATION REGISTRY::

allows me to change my view to that

And running GET-CHILDITEM on that context will give you a more familiar list

image

Now we change it back with SET-LOCATION C:

So what can you DO with it?

How do I find the information these objects are providing and what to do with them?

Well that’s for our next session when we discover the “GET-MEMBER” command and the enormous box of Digital toys it reveals!

Sean
The Energized Tech

Leave a Reply