Easy Commands to Teach Your Friends about PowerShell

Easy Commands to Teach Your Friends about PowerShell

  • Comments 7
  • Likes

Summary: The Scripting Wife learns about easy Windows PowerShell commands so she can teach her friends about Windows PowerShell.

Microsoft Scripting Guy, Ed Wilson, is here. This morning is rather cool, but I am sitting on the front porch sipping a cup of pomegranate tea that I brought back with me from Montreal. It is a nice caffeine-free tea infused with hibiscus and cinnamon. Because it is naturally caffeine free, I do not need to worry about getting jittery. I can sip it all day long if I wish. It goes well with Anzac biscuits, and it makes a nice mid-morning break. I have completed answering scripter@microsoft.com email, checked comments posted to the Hey, Scripting Guy! Blog, checked out things on Twitter and Facebook, and I am now ready to start working on events for the 2012 Scripting Games. I have had a great response from Microsoft MVPs and others in the Windows PowerShell community in response to my query about judging the 2012 Games.

Anyway, let me think about the games while I sip this fine cup of tea…

“There you are,” the voice cracked the tranquil morning stillness like someone dropping a tray of dishes in the dining room of a fine restaurant. “I have been looking all over for you.”

“I have been here,” I replied. “This must have been the first time you came by this location.”

“Don’t be cute,” she bristled. “Obviously this is the first time I have seen you since I began looking.”

I spied her laptop. It was nestled under her arm like a football in the arms of a running back heading towards the end zone.

“Is there something I can help you with?” I politely asked.

“You know you should not end a sentence with a preposition,” she stated sarcastically.

“Is there something I can help you with, my dear,” I revised.

“Much better. Yes, there is something with which you can assist,” she rejoined. “I am curious, what are the easiest Windows PowerShell cmdlets to use?”

“In my mind, the easiest cmdlets to use are the ones that just seem to work when you type the command and press ENTER. For example, open the Windows PowerShell console, and type Get-Process,” I instructed.

The Scripting Wife opened the Windows PowerShell console, and typed the following:

Get-Pr<tab><enter>

The command and its associated output are shown in the image that follows.

Image of command output

“Another easy Windows PowerShell command is the Get-Service cmdlet, which returns information about services on the computer. Go ahead and try it,” I suggested.

The Scripting Wife typed the following command:

Get-s<tab><enter>

The resulting command and its output are shown in the following image.

Image of command output

“Another easy cmdlet is the Get-Date cmdlet. It retrieves the current date and time from computer. Why don’t you try it as well,” I said.

The Scripting Wife quickly typed the following:

Get-D<tab><enter>

The command and its associated output are shown in the image that follows.

Image of command output

“One other cmdlet that is very useful, and is also extremely easy to use is the Get-Hotfix cmdlet. It displays a listing of all the hotfixes that are installed on the computer. Go ahead and give it a try,” I suggested.

She typed the following keystrokes.

Get-hot<tab><enter>

When she pressed ENTER, the computer paused for a second, and then the output that is shown in the following image appeared.

Image of command output

“That is pretty cool,” the Scripting Wife said.

“There are two other commands that are really useful, and really easy to use: Get-History, which shows you all of your previously typed commands, and Start-Transcript, which records the commands and the associated output. Why don’t you type Get-History and see what it displays,” I suggested.

She typed the following characters:

Get-Hist<tab><enter>

She then used the Up arrow to recall the previous command, and then entered it again. The output is shown in the following image.

Image of command output

“Let me show the output from a transcript,” I said as I turned my laptop screen towards her. The transcript is shown in the image that follows.

Image of command output

“Yes, there are other really easy cmdlets to use, such as Get-Culture, Get-Acl, Get-ChildItem, and Get-Random. They all return information, but they are not quite as immediately useful as the previous cmdlets,” I said, “By the way, why do you ask?”

“Well, I was talking to one of my friends about the Scripting Games, and she asked me about Windows PowerShell. I thought the best way to tell her about Windows PowerShell was to show her, and so I wanted to know what cmdlets would be best to use,” she replied.

“Cool,” I said. There was really nothing else for me to say, except perhaps, “Real cool.”

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Hi Teresa,

    Thank you very much for the list of easy commands!

    Now I have some commands handy, which I can offer to my friends ( if I had any ) and tell them that theses are "officially easy" commands that they should learn at first ...

    I just wonder what I should answer if they ask me if all easy commands start with the verb "Get"? Maybe I should introduce the "Get-WinEvent" cmdlet to show them that not all "Getters" are easy and the "Set-Date" cmdlet to offer an easy "Setter" :-)))

    Good to know that Ed is busy preparing the next games and you can tell him:

    "Only $(((get-date ('2012-04-02')) - (get-date)).Days) days until the 2012sg will begin"

    Klaus (Schulte)

  • Great article, as always... BUT:

    '“There you are,” the voice cracked the tranquil morning stillness like someone dropping a tray of dishes in the dining room of a fine restaurant.' -> while this sentence has brilliant parallel in it, I can hardly see how Teresa's voice can get any close to the noise you get when you drop dishes, even if it's 5 AM... ;)

  • Great post! Anyone who is new to PowerShell should read this.

  • @Klaus,  Funny you should mention that, I asked the same thing to Ed, right after he said Get-Coffee;Get-Lunch  :-)

  • @Bartek, Thank you for your kind words. Get-Smile | " :-)"

  • @Craig Thank you, to encourage other beginners is my whole purpose here.

  • Hi...

    Very Use Information Thans For The Link....

    <a herf="stctechnologies.webnode.com/">STC Technologies</a>