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.
“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.
“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.
“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.
“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.
“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.
“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