PowerShell MVP Oisin Grehan posted a very promising PowerShell module the other day. He calls it the PModem File Transfer Protocol. It is based on the old bulletin board file transfer protocols of the late 20th century, which I have to admit I fondly remember using. Of course Oisin’s work intrigued me and after playing…
Category: CommandLine
Is That Folder Empty?
In keeping with my recent trend of offering solutions based on PowerShell v2.0, here’s a function I’ve revised to test if a folder is empty. I can’t recall where I used the original function or if I ever did. But I came across it recently and decided to give it a facelift. Manually determining if…
5 Minute PowerShell
My October Mr. Roboto column is now available online. The article contains my suggestions for how someone completely new to PowerShell might spend their first 5 minutes. Perhaps not literally, since I expect most people will want to spend more than 60 seconds on my suggested steps. But overall I thought my proposal was a…
Out-MSWord Revised
This summer I wrote about a function I developed called Out-MSWord. The function was discussed in my Practical PowerShell column which was published in the free e-Journal Windows Administration in RealTime put out by RealTime Publishers. The original was published in Issue #17 if you are interested. The function accepted pipelined input and created a Microsoft Word document. Naturally, you need to have Microsoft Word installed in order for this to work.
PS C:\> get-service | out-MSWord
The function accepted a number of parameters so you could control font name, size, color, append, and more. The function was written for PowerShell v1.0 but also worked on PowerShell v2.0. However, I was revisiting the function and realize there were places I could tweak, such as adding additional error handing. I also realized that if rewrote this for PowerShell v2.0, I could create an advanced function and take advantage of cmdletbinding, advanced parameters and help.
Absolute Beginning PowerShell
I was looking at my current Mr. Roboto column “Polish Your Shell” on learning PowerShell by starting with 3 basic commands and noticed a lengthy and serious comment. I’ve always felt PowerShell is easy to use and learn, which was the point of my column. However, the comments paint a different story and one that I feel is more pervasive.
I’m afraid the comment is representative of how PowerShell is perceived by many IT admins. They don’t have time to learn anything new or their hair is constantly on fire (to borrow a favorite Jeffrey Snover phrase). Even though the concepts of cmdlets, parameters and a pipeline seem easy and practically self-apparent, they are not. Especially for an administrator who has never had to open a command window before. Granted GUI-based admin tools might have been cumbersome, but at least you could make some educated guesses about how to use it. A command line is very different.
Powershell: Exit Stage Left
While reviewing and revising the manuscript for Windows PowerShell v2.0: TFM 3rd ed. I had the opportunity to revisit our chapter on working with events in PowerShell. An event in Windows is when something happens like a mouse-click, a process being created or window resized. In PowerShell you can easily watch for an event of interest and then do something when it happens or fires. This is referred to as an event subscription.
PowerShell v2.0 has a few event related cmdlets you can use for creating an event subscription: Register-WMIEvent, Register-ObjectEvent and Register-EngineEvent. Today I want to show you something I think you might find helpful using the last cmdlet in the list.