PowerShell Mini-game: Equality

§ April 9, 2013 14:06 by beefarino |

In light of the upcoming community Scripting Games, I have a PowerShell brain teaser for you.  

Query: In PowerShell, when is the following statement true? Explain why.

     ( $a -eq $b ) -ne ( $b -eq $a )

Submit your answer as a comment, or post it on your own blog and provide a link in the comments of this post.  The best explanation (as chosen by me) will receive a complimentary single-user license for SeeShell (a $249 value).  You have until April 16, 2013 to submit your answer; the winner will be announced April 17, 2013.

Open Sourcing of the ASP.NET Membership PowerShell Provider

§ July 27, 2010 01:41 by beefarino |

Over the past year I've blogged and presented about the benefits of targeting PowerShell as a framework for supporting the applications you develop.  I firmly believe PowerShell is the most appropriate choice of platforms for creating interactive and flexible toolsets.  Today I'm proud to announce that one of the original projects that led to this belief - the ASP.NET Membership PowerShell Provider - is being released by Code Owls LLC as open source.

You can find the project hosted on CodePlex here.

My reasons for this don't really center around wanting to share the code.  That is, I've already written detailed blogs about creating this particular provider, and plan to round those out with a few more posts:

So in my mind, the code is already public.  The primary reason I wanted to get this project public and posted was to get people using it and contributing to the project.  At the moment, the glaring omission is Active Directory support, and this is where I need the most help since I don’t have ready access to an Active Directory environment.  If you’re interested in helping out, by all means contact me through this blog or through the CodePlex project page.

I realize this project may be a bit niche, but its a niche is begging to be filled.  The existing Membership toolset is atrocious, and the applicable PowerShell offering is robust, interactive, and full of chewy goodness.


CodeStock 2010: PowerShell as a Tools Platform

§ July 4, 2010 01:54 by beefarino |

At long last, I'm home from my working vacation and have a chance to do some CodeStock postprocessing.  Several people have asked me for the resources from my PowerShell presentation.  You'll find downloadable RARs of the powerpoint and code below.  I've also placed the deck on SlideShare for convenience:

The bulk of the code is described in the following posts:

I will be adding a few posts soon to round out the code coverage.  Feel free to drop me any questions or concerns you have.  I'd love the chance to give this talk to any .NET user groups in the area!

ASPNETMembership.rar (284.35 kb)

PowerShell as a Tools Platform.rar (1.17 mb)

get-buildstatus PowerShell Script

§ July 21, 2009 08:16 by beefarino |

I just bashed out this powershell script to query the build farm status using the CC.NET server report XML page:

# get-buildstatus.ps1
$client = new-object system.net.webClient
$client.Headers.add("user-agent", "PowerShell")
$data = $client.openRead( 'http://builddashboard/ccnet/XmlServerReport.aspx' )
$reader = new-object system.io.streamReader $data
$s = $reader.readToEnd()
([xml]$s).CruiseControl.Projects.Project | ft;

Wicked simple - the WebClient class is used to connect to the build dashboard, and a stream reader object pulls the farm data.  The data is XML, which PowerShell considers warm butter and happily pivots and formats as a pretty table:

> get-buildstatus
name           category       activity       lastBuildStatu lastBuildLabel lastBuildTime  nextBuildTime  webUrl
----           --------       --------       -------------- -------------- -------------  -------------  ------
SuperDuo 3....                Pending        Success        SuperDuo_14890 2009-07-21T... 2009-07-21T... http://buil...
SuperDuo Sa...                Pending        Success        SuperDuo_14725 2009-06-16T... 2009-07-21T... http://buil...
SuperDuo 2....                Pending        Success        SuperDuo_14706 2009-06-09T... 2009-07-21T... http://buil...
SuperDuo 2.2                  Pending        Success        SuperDuo_14888 2009-07-21T... 2009-07-21T... http://buil...

Of course, if you have the PowerShell Community Extensions installed, the get-url cmdlet reduces the script to a one-liner:

# get-buildstatus.ps1
([xml](get-url 'http://builddashboard/ccnet/XmlServerReport.aspx')).CruiseControl.Projects.Project | ft;

I think I'll push this into a PowerGUI powerpack...

Super happy fun time deluxe!  (Enjoy!)