Powershell is truly a wondrous giant box of toys.
Just when you think you’ve figured it out, somebody puts something in front of you. Like the other day when Shay Levy unlocked the secret to Clearing the Windows Event logs. I had to ask how he did it.
The process is both complex and simple but it DOES show you how you can play with Powershell and unlock the hidden treasures within.
In the case of the GET-WINEVENT Cmdlet (where there was no corresponding CLEAR-WINEVENT) Shay used a GET-MEMBER on the GET-WINEVENT Commandlet.
I didn’t understand at first why until I tried it myself.
Beside EVERY property, Method, Note Property is a reference to the Windows .NET Framework library being used.
At this point every IT PRO in the net reading this Blog post just fell asleep!
For those of you still awake, think of the Library as the world’s BIGGEST Database of information and systems within Windows. They all have “funky little names”.
Let’s do one on GET-CHILDITEM to show you. On the right hand side of CreationTime you’ll see a reference to System.DateTime
You can go to www.msdn.com to pull up specs on what this Library has and how it can be used. Just type in the name within the top search box. You’ll probably see a list pull down below you. Click on the one that matches what you’re searching for.
The next Windows will pull up a HUGE pile of results from the MSDN online Documentation. You’ll want to filter that out by .NET Framework 3.5 or 3.0 (Depending on whether you’re working with Powershell 1.0 or 2.0, not being a Developer I would suspect there are SOME differences between 3.0 and 3.5, so for best results, choose the version matching your Powershell)
In the resulting list odds are the one at the top is your “Holy Grail” of information about that Library, or at least a tablet into it’s knowledge
The article should give you some indication about what you can do with it. To me an ITPro? It’s mostly gibberish! But’s COMPUTER Gibberish, so it’s sort of makes sense!
But here’s a neat trick Shay showed me to find out what you might be able to play with. Take the Libary name and type it like this in Powershell
Yes A square bracket at the Beginning, one at the end and TWO Colons.
Don’t hit Enter, Hit tab, you may see some additional functions appear, sometimes properties. I chose “DateTime” because it Does give us a few easy ones to play with
It produces with the Tab
Amongst others. Hitting enter will either yield results or yield an error. If it’s a feature in Windows that presently does not have a Powershell Commandlet, this is your doorway into unlocking those features.
It’s pretty heavy for ItPros I admit. This is not our world. But understanding a LITTLE of that world, unlocks a LOT within Windows and helps within the greater Master of Powershell
The Power is in YOU.
The Energized Tech