Browse by Tags
All Tags »
PowerShell (RSS)
I was playing around in the registry the other day and found the PowerShell API lacking in a key area. There does not appear to be a good way to detect the presence of a Registry Name/Value pair. All of the operations such as New, Delete,
Read More...
Previously I blogged about PowerShell’s lack of closure support within a script block. This presents a significant hurdle in developing a LINQ like DSL for powershell which I’ve been working on. Imagine the following syntax $a = from it in
Read More...
The Take pair of functions are very similar to the Skip functions . The Take expression does essentially the opposite of the Skip functions. Skip is useful for getting elements further down the pipeline. Take is used for getting elements
Read More...
Next up in the PowerShell LINQ series is SkipWhile . This LINQ function takes an enumerable instance and a predicate. The function will skip the elements in the enumerable while the predicate is true. The argument to the predicate is
Read More...
The PowerShell pipeline, is fairly similar to C#/VB’s LINQ. Both filter a group of elements through a series of transformations which produce a new series of elements. The devil is in the details of course but I’ll get to that in a future
Read More...
Script blocks are a concise way of representing an expression or statement group in Powershell. It’s the C#/F#/VB lambda equivalent for PowerShell. One difference between C#/F#/VB lambda expressions and a scriptblock is the lack of lexical
Read More...
Script blocks are a powershell construct for storing an expression or group of statements inside an expression. It’s the equivalent of a C#/F#/VB Lamba expression. Recently I needed to use a script block but found I had forgotten how to read
Read More...
With all of the great built-in commands for processing pipelines the absence of a good command to count the number of elements in a pipeline seems to stand out. The best built-in way to count the number of objects in a pipeline is to convert the
Read More...
I constantly get tripped up in my powershell scripts/commands because I run them against a binary file. In particular when I’m searching through a directory structure looking for a particular string or regex. I’ve found the simplest way to
Read More...
Recently I was working on a PowerShell script which involved translating byte arrays into strings using the appropriate encoding. Unfortunately I kept getting the wrong choice for encoding and printed out essentially random data to the console screen.
Read More...
As part of my transition into using 64 bit windows I keep running into a problem with some scripts. I have a whole set of Powershell scripts that are dedicated to ensuring certain programs are installed on all of my dev machines. Or that certain
Read More...
Recently at work I started using Windows 2008 64 bit edition. Mainly for hyper-v but powershell also comes as part of the deal. I'm starting to work through the fun issues of getting some of my environment specific scripts to run in a 64 bit
Read More...
Quick script you can run at login to ensure that your XP machine is being defragmented. I chose 1:00 AM every evening but you can quickly alter that in the script. I have this script run as part of my regular set of configuration scripts to ensure that
Read More...
One operation I frequently perform is use a powershell pipeline to filter out a large set of data. Typically I don't care what is in the result but rather is there actually anything left in the pipeline. I can't find a good powershell built-in to perform
Read More...
Recently I made a very large update to our code base. Our code base lacked a standard way of guarding entry and exit points into the various components. Having said guards is useful for error handling, tracing, reducing redundancy, etc ...
Read More...