Monthly Archives : January 2007

Home  >>  2007  >>  January

IRC chat bot and monitor

On January 31, 2007, Posted by , In Cool,PowerShell,Utility, With Comments Off on IRC chat bot and monitor

Last weekend, I asked my wife if she could think of anything inappropriate or unusual to do with PowerShell. She came up with some good ideas and one of them was to write a chat/IM client. A full client takes time, so with a nod toward PowerShell’s administrative uses, I…

Debug and Verbose colouring

On January 29, 2007, Posted by , In Hint,PowerShell, With 2 Comments

Over the weekend, I set about writing an IRC chat client/channel monitoring tool in PowerShell (more on that in a day or so) and one of the things I was doing a lot was writing verbose and debug information to the console. By default, Write-Verbose and Write-Debug cmdlets write nothing…

Making functions *really* read-only

On January 26, 2007, Posted by , In Odd,PowerShell, With 2 Comments

Over at the excellent PowerShell Team Blog, Bruce Payette wrote about Controlling PowerShell Function (Re)Definition. However, making a function constant does not prevent it from being shadowed in child scopes. Given that a child scope is created in any script, new function definition or script block, this makes it very…

Updated get-bufferhtml

On January 25, 2007, Posted by , In Announce,Cool,PowerShell,Utility, With 2 Comments

A while back, I posted an article: Console screen grabs in html. I fixed some bugs and added a couple of new features to the script get-bufferhtml.ps1, and have updated the article with examples. Enjoy!

Webserver and RSH in PowerShell

On January 24, 2007, Posted by , In Cool,PowerShell, With 1 Comment

Ever wanted to control a PowerShell session from a web browser or curl/wget on another machine? Yes? Well it surprisingly simple using PowerShell to script the System.Net.HttpListener. Here’s a working example with some genuine uses (well useful for me). I’ll leave all the security and risk concerns as an exercise…

Running pipelines in the background

On January 22, 2007, Posted by , In Cool,PowerShell,Rant, With Comments Off on Running pipelines in the background

In the unix world, we’re used to being able to run the different commands in a pipeline in different threads/processes. This is usually a lot more efficient when the producer/consumer rates vary, and makes use of multiple cores/cpus. For example, cmd1 | cmd2 will run the two commands in separate…

Banners

On January 19, 2007, Posted by , In Cool,PowerShell,Utility, With Comments Off on Banners

In the old days, when you printed something out, you’d have to wander down to the print room and find your output in a stack of fanfold with the job name printed as a large banner on the top. I miss those days so I wrote a banner script to…

Alternate Data Streams

On January 18, 2007, Posted by , In PowerShell,Rant, With 2 Comments

NTFS has the ability to associate multiple data streams (aka forks) to a file. It’s not very well supported in most Microsoft tools and not very well known, but I use them quite a bit for associating metadata with files. Unfortunately, PowerShell (or rather .NET) doesn’t support them very well.

Pipe or no pipe?

On January 17, 2007, Posted by , In Cool,PowerShell,Quiz, With 2 Comments

Many built-in cmdlets take input from the pipe, but alternatively let you specify an input with the -InputObject parameter. An example is the Get-Member cmdlet. I want to be able to do this with my own functions, but as far as I can tell, there is no built-in mechanism for…

Hashes and properties

On January 15, 2007, Posted by , In PowerShell,Quiz, With 1 Comment

I really like the way that PowerShell handily formats pipeline objects when displaying them in the console, eg get-childitem in a file system directory returns a collection of file objects and the output is like the old DOS dir command. Additionally, I really like the way that hashes behave like…