Summary: We are introduced to our friend, Oliver Script, who discovers the magic of Get-Help in Windows PowerShell.
There are times when dreams wander away…
when the magic fades because we forget to believe in the possible…
when we let the whispers of the possibilities of tomorrow silently wander off and disappear into the night.
Often we call this “adulthood.”
Then there are more commonly the times where the dreams are simply those magical adventures we embark upon during the midnight hours. However, there are the rare and wonderful exceptions where the dreamer and the dream join together, when the visions and hopes strike a spark in the night and alight something special.
This is such a story—a story of a young fellow we know as Oliver Script.
Oliver’s story begins as many do. He entered this world amongst noise, beeping machines, shiny lights, and the smell of sparks in ozone. Perhaps this is where it all began for him—the thing that lit the dream in some way.
He grew up as many children did. He dreamed of various things like other children, and yet unique in his own way. There were dreams of becoming an astronaut and flying to far off Alpha Centauri…or maybe becoming an architect like his father. At one point, Oliver even thought he might become a professional cubist, unlocking the magic of Ernő Rubik…
until a freak accident involving grease and a 300 horsepower 17x17x17 cube dashed away that dream.
So life roamed along on its merry way as Oliver passed through his days in various schools, learning his trades. Eventually, he discovered he had a true passion for technology, after one day using his first ever computer.
There was something magically indescribably wonderful to Oliver as he began to navigate the system—almost as if it were an extension to his own body. Although he truly wanted to become an architect, just like his Dad, something here was pulling him in. Here was a world that had the structure of architecture, but in a truly unique way.
The one thing that troubled Oliver was this odd clicking of the mouse. Computers were meant to be fast and efficient, and such a manual process seemed “highly illogical” (as his favorite fictional character would so often say).
By doing some online research, he discovered that the better way to perform repeatable tasks was by using a Shell-based environment. Navigating the operating system, he found a strange little blue button staring him right in the face on the task bar. “Windows PowerShell” it was called.
“But how am I to use this?” the young lad wondered. “Where do I start?”
At first Oliver wanted to simply see something interactive on the screen. In reading up on Windows PowerShell, he found that everything worked by using a series of “cmdlets,” which are Verb-Noun paired commands to interact with the environment.
His first attempt was to see what was available in the environment from the Get-Command cmdlet, which was designed to show all of the cmdlets in the system. Look at what he discovered!
Oliver blinked as the plethora of commands flowed past his eyes! He discovered he could use an asterisk as a wildcard character to find certain types of commands. Oliver wanted to echo something cool to the screen, so he decided to find something with the word “write” in it by using the Get-Command cmdlet with some extra information:
Write-Host seemed to suggest that it might do what Oliver wished, which was echo to the console “Host” whatever he wanted. But he wanted to see how to use it. Reading further, he discovered another cmdlet called Get-Help, which would show him how to use the cmdlets.
Oliver entered in the little blue console the line to retrieve Help for how to use the Write-Host cmdlet:
“Well that’s somewhat useful, but if only there was a way to get some examples of this in use…”
With the magic of the Internet, our good chum, Oliver, ran into a parameter called Examples for the Get-Help cmdlet, which would do exactly that!
Get-Help Write-Host –examples
He could now see that to place something on the screen, all he needed to do was type Write-Host and the information he wanted to see. Here is what he typed:
Write-Host “I am Oliver Script, and someday I will work for Microsoft. Scripting is cool!”
Oliver jumped up and down—delighted that with very little effort the machine did exactly what he wanted it to do! He also found that if he added the -online parameter to Get-Help, it would bring him to the most current documentation online from Microsoft!
Oliver played a bit more with Write-Host by adding color to the output just for fun:
The one thing he could not understand was that every time he used the Write-Host cmdlet, he swore he could hear a cat’s meow in the distance…
But he loved this new thing in his life called computers. In addition, having a system that was consistent about how to obtain Help struck him as invaluable! He couldn’t wait to use it further!
Soon, however, Oliver’s school days passed on. He wanted to join into those higher schools of learning, such as colleges and universities. He passed his SAT test with a score of over 1340, so he knew he had many choices before him and he had an excellent chance to choose between many.
But there was a small problem. Oliver had no money, and he had to seek work immediately if he was to get proper training in technology.
Work…it did come and plentiful it was, but not in the work he wanted. Now became a long and arduous journey of many years as Oliver was trapped within the confines of a job that no future scripter would ever want as the foul words left his lips daily for many years, “Would you like fries with that?”
Will Oliver learn more Windows PowerShell? Will he ever leave the confines of such a greasy maddening hell? Will he ever get to college? Stay tuned to tomorrow’s episode of Oliver Script: A Holiday Tale on the Hey, Scripting Guy! Blog.
We invite you to follow the Scripting Guys on Twitter and Facebook. If you have any questions, send an email to the Scripting Guys at email@example.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, remember the Power of Shell is in You.
Sean Kearney, Windows PowerShell MVP and Honorary Scripting Guy