Welcome to MSDN Blogs Sign in | Join | Help

jaredpar's WebLog

Code, rants and ramblings of a programmer.

Syndication

News

Now Reading

Expert F#

What's a better book to read when learning F#?

Essential WPF

Thus far the best book I've read on WPF. Gets right down to working with WPF and the goals/history.

Purely Functional Data Structures

Reading this book makes me feel like I'm back in college. It will really get your mind going and is best read with a whiteboard handy.

Blog Roll

Eric Lippert
Dustin Campbell
Jon Skeet
Coding Horror
Brian McNamara
Hub FS
Full List

Browse by Tags

All Tags » PowerShell   (RSS)
Test-ItemProperty utility function
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...

Posted Friday, June 12, 2009 10:00 AM by Jared Parsons | 0 Comments

Filed under:

Simulating Closures in PowerShell
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...

Posted Monday, February 02, 2009 8:00 AM by Jared Parsons | 0 Comments

Filed under: ,

PowerShell LINQ: Take-Count and Take-While
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...

Posted Friday, January 16, 2009 8:00 AM by Jared Parsons | 2 Comments

Filed under: , ,

PowerShell LINQ: Skip-While
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...

Posted Wednesday, January 14, 2009 8:00 AM by Jared Parsons | 2 Comments

Filed under: , ,

LINQ like functions for PowerShell: Skip-Count
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...

Posted Tuesday, January 13, 2009 8:00 AM by Jared Parsons | 2 Comments

Filed under: ,

Script Blocks and Closures (or lack there of)
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...

Posted Thursday, January 08, 2009 8:00 AM by Jared Parsons | 0 Comments

Filed under: , ,

Script Blocks and Arguments: Figuring it out for myself … again
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...

Posted Wednesday, January 07, 2009 8:00 AM by Jared Parsons | 4 Comments

Filed under: ,

Count-Object
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...

Posted Friday, December 19, 2008 8:00 AM by Jared Parsons | 1 Comments

Filed under:

Sorting out Binary Files
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...

Posted Monday, December 01, 2008 8:03 AM by Jared Parsons | 1 Comments

Filed under:

Stop the Beeping!!!
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...

Posted Monday, November 03, 2008 8:00 AM by Jared Parsons | 2 Comments

Filed under:

Program Files, I just want the 32 bit version
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...

Posted Tuesday, October 21, 2008 8:00 AM by Jared Parsons | 0 Comments

Filed under: ,

Powershell and 64 bit windows helper functions
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...

Posted Thursday, October 16, 2008 8:00 AM by Jared Parsons | 0 Comments

Filed under: ,

Using PowerShell to make sure your XP machine is defragmented
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...

Posted Friday, June 13, 2008 8:00 AM by Jared Parsons | 0 Comments

Filed under:

Is there anything in that pipeline?
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...

Posted Thursday, June 12, 2008 8:00 AM by Jared Parsons | 0 Comments

Filed under:

Saved by PowerShell
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...

Posted Wednesday, May 07, 2008 8:00 AM by Jared Parsons | 0 Comments

Filed under: ,

More Posts Next page »
Page view tracker