I wasn’t completely satisfied with the updated version of my Get-NumberedContent function. You should still refer to the earlier post for details on how to use the function. But I had some issues with the previous version and realized there were a few bugs. I’ve since updated the Get-NumberedContent function.
Tag: PowerShell
Get-Printer
I think Out-Printer is a very handy cmdlet, and one that doesn’t get used much. Pipe any cmdlet to it and the output will be printed to your default printer. You use it the same way you would Out-File except output is printed instead of saved to a file. The cmdlet also has a parameter…
Drive Report Console Chart
In thinking about some of my recent posts, I realize I should make clear that these scripts and functions are not necessarily good PowerShell examples. They don’t take advantage of objects and the pipeline. They are single purpose and one-dimensional. Not that there’s anything wrong with that. My recent examples, and the one I have…
More Fun with Get-NumberedContent
As much fun as the original Get-NumberedContent function was after using it for awhile I realized I had imposed some limitations. I also realized it needed to be more flexible. What if someone wanted to specify a different color or use a different comment character such as a ; in an ini file? I also…
Get-NumberedContent
One of the reasons I enjoy Twitter is that it exposes me to PowerShell ideas and enthusiasts beyond my immediate circle. I came across a blog post from David Longnecker about a short function to display file content in a numbered format. Basically taking Get-Content and adding a line number to the output. Well I’m…
Out-Notepad Redux
I got some great comments and suggestion on my original version of Out-Notepad, which should work just find on PowerShell v1.0 or 2.0. However, because v2.0 has such terrific features I decided to rework my function into a PowerShell v2.0 only version that also incorporates a few new features.
Out-Notepad
Maybe this isn’t the most earth shattering PowerShell function you’ll ever come across, but it saves me a few keystrokes. There are times when I want to see the results of PowerShell expression but the console output is insufficient. I want to see the results in a text file opened in Notepad so I can easily scroll, search or whatever.
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…
Add Tooltip help to your PrimalForms script
I’ve been doing some work lately in the newest version of SAPIEN’s PrimalForms 2009. I like to make my scripts as user friendly as possible without forcing someone to read lengthy and boring documentation. One technique that I’ve started using is to use a ToolTip control and offer a short description or instruction when the…
PrimalForms 2009 Script Editor
SAPIEN’s Primal Forms 2009 now has an integrated script editor that you can use as a standalone editor for PowerShell scripts. The app has integrated help, popup command help, a PowerShell browser, a .NET object browser. As you can see in the screen shot I’ve started a very basic PowerShell script.
Once saved, I can run the script and view the results in the output panel. You can open and edit existing scripts as well. If you want a more full featured editing experience with code samples, snippets and more, or if you still need to work in other languages like VBScript, you’ll want PrimalScript 2009. But let’s say you only require an easy to use PowerShell script editor that provides a Windows Form feature, then PrimalForms 2009 is the ticket.
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.
WinRM: Domain or Workgroup?
I’m curious about something and would like to hear from you. PowerShell v2 remoting uses WinRM which in a domain environment is very secure and easy to use. You can even use a GPO to configure your domain members. However you can also use WinRM in a workgroup environment but you have few hoops to…
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.