Ever get bitten by a bug and need to know “How was this done?”
In Powershell there are many functions you create, and just as many pre-written. But when I go to see how a function was done (so I can learn more), I find if the function has more than one line you just get something like this.
Which doesn’t do you a lot of good.
But really it’s not difficult to view. For example if you want to get a list of all functions (which are like Cmdlets but you can view / edit and change them) run the following command
or you can also run a
GET-COMMAND –CommandType Function
…The output and results are the same, a BIG list of functions and their definitions or at least PARTIAL definitions.
So if you see a particular function you’re curious about in the list like say GET-EXBLOG (which is part of the Exchange Command Shell) just run this command
(GET-COMMAND GET-EXBLOG –CommandType Function).Definition
In both cases you will see the code that produces that Function which is
invoke-expression ‘cmd /c start http://go.microsoft.com/fwlink/?LinkId=35786′
Which goes off and launches the Exchange Blog.
So I never knew how to launch a Browser session from Powershell. But now thanks to viewing this function I see a way. Maybe not necessarily the BEST or the ONLY way but it’s a good way to learn if you can see how somebody else did it.
Powershell – Learning *IS* easy 🙂
the Energized Tech