Category Archives : PowerShell

Home  >>  PowerShell

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…

Getting normality back

On January 14, 2007, Posted by , In Cool,PowerShell, With Comments Off on Getting normality back

The PowerShelling that I do mostly involves messing around the console window – dimensions, colours, title, etc. I wanted an easy way to get normality back so I added this to my $PROFILE. Nothing fancy or clever, but here it is:

Space Invaders with sound!

On January 12, 2007, Posted by , In Cool,Invaders,PowerShell, With 2 Comments

After yesterday’s attempts to make noises, I added basic sound support to psinvaders. On my setup, it seems that I can only play one sound at a time, so a new sound stops a previous, and it crackles, but that could be because of poor sound virtualisation in Parallels Desktop…

Making noises

On January 11, 2007, Posted by , In Cool,PowerShell,Quiz, With 4 Comments

There are twothree ways I know of to make noises in PowerShell. 1. Simple and most boring: use the internal speaker’s beep. write-host “`a`a`a” 2. Slightly better, use the .NET console beep. This plays A above middle C for one second. [console]::beep(440,1000) Both of the above are synchronous, ie, the…

Script Updates

On January 10, 2007, Posted by , In Cool,PowerShell, With Comments Off on Script Updates

After receiving feedback from a few people (thanks!), I’ve updated two of the scripts posted here previously. Convert images to text (ASCII art) This had a problem where a division by zero error would occur if the specified image file wasn’t fully qualified. Fixed script is here: convert-image2text.ps1. Console screen…

What colour is yours?

On January 8, 2007, Posted by , In Odd,PowerShell, With 3 Comments

I noticed something very odd today. My PowerShell console thinks that the default white text is actually “DarkYellow.” If I set it to “White” there is no visible difference. What colour is your default console? Update: I’ve found a use for “darkyellow” being white. When you run something like findstr…