Browse by Tags

Tagged Content List
  • Blog Post: Image Manipulation in PowerShell

    The other week, I showed a Get-ProgID function that I used to help someone at Microsoft Research find a good object to talk to images. A few comments jumped to one of the possible solutions, which is to use the .NET Drawing assembly (which I have to load first). I wanted to be reasonably sure that the...
  • Blog Post: Get closure with GetNewClosure

    Have you ever created scriptblocks on the fly, say in a foreach loop, and they totally mess up because they all have the same value? This is something sort of advanced, and typically used when you’re proxying an object. The most basic example would be, taken from ( http://www.powershellcommunity...
  • Blog Post: Test-PSCmdlet

    Everyone needs to get good with Advanced Functions – this is the easiest path to the best semantics for everyone. In previous posts we’ve shown how you can add a few simple attributes and get a TON of stuff for free. There is a LOT more to advanced functions. You can go VERY VERY far with advanced functions...
  • Blog Post: Get-Verb

    When I write a PowerShell function, I try to ensure that it follows the PowerShell standard verbs. These verbs actually exist as static properties in a few different types in PowerShell, so I thought I'd make a quick advanced function so I can get all of the Verbs. Check it out: Get-Verb Synopsis: Gets...
  • Blog Post: A Module to Create Modules and Advanced Functions

    [1/3/09 Update - the original link to the attachment containing this code was broken but is now fixed. Sorry. jps] It is hard to overstate how important Modules and Advanced Functions are. If you are a PowerShell user - you need to take the time to learn these new mechanisms and use them as your first...
  • Blog Post: Get-MarkupTag

    On my personal blog ( Media And Microcode ), I've been posting a series called "Scripting the Web", which introduced a function called Get-MarkupTag. Get-MarkupTag is a very handy little function that coerces individual tag elements of a web page into HTML, so you can scrape data from a webpage...
  • Blog Post: Merry Christmas From PowerShell: The CodeDownloader Module

    Twas the night before Christmas, and all through the net PowerShell lovers were wondering exactly what they might get Their readers were ready, their minds were aware That more joy of CTP3 would soon be there A cmdlet, a function? What has the PowerShell team done? How about a whole module, to share...
  • Blog Post: Resolve-ShortcutFile

    If you're like me, you've got a browser favorites folder that is full of wonderful PowerShell code snippets. Ideally, it would be great to have a way to bring those favorite snippets into PowerShell so that my favorites folder becomes a code library. Doing this presents several challenges. The first...
  • Blog Post: PowerShell v2 Pipelining in 73 (make that 53) Characters

    I started using Twitter and saw a request from Thomas Lee for help about pipelining in CTP3. The thing about Twitter is that the messages have to be tiny so I wasn’t sure I could answer using it. It turns out I can solve this problem AND give a usage example in 73 characters. Here goes: PS> function...
  • Blog Post: Write-CommandBlogPost

    On the PowerShell team, we're big believers in the Virtuous Cycle. As you learn PowerShell more and more, things should get easier and easier to do. Inline help is a great example of the virtuous cycle, because it allows you to write scripts in such a way that they're easy to learn about the same way...
  • Blog Post: Dreaming In PowerShell V2 : Lottery Numbers with Get-Random

    Tobias Weltner writes a blog called Dreaming In PowerShell, and he recently posted a way to get a list of unique lottery numbers with PowerShell.   Dreaming In PowerShell is a cool blog, and the post is interesting, but it makes an assertion that's no longer true in V2.  He uses System.Random...
  • Blog Post: PowerShell V2: ParameterSets

    One of the great benefits of PowerShell V2 Advanced Functions is the ease in which you can support parametersets. ParameterSets are, well, different SETS of valid parameters. For instance you can say: Get-Process -id 0 Get-Process -Name *ss Those are 2 different parametersets for the Get-Process...
  • Blog Post: More Advanced Functions - Get-Assembly and Get-ExportedType

    Tyson Kopczynski has just published a great article Fun with PowerShell 2.0 Eventing! That inspired to to write a script to automatically backup my modules directory. I'm doing a lot of scripting this week and I don't want to lose my work if I make a mistake. I thought I would write a scripting using...
  • Blog Post: Advanced Functions and Test-LeapYear.ps1

    Welcome to CTP3! There are just an amazing amount of really important features in V2 but the one I want everyone to start using ASAP is Advanced Functions. In CTP2 we called this cmdlets. We dropped that term in favor of taking the idea of a FUNCTION and just making it more and more capable. It is a...
  • Blog Post: Emit-XML

    I was writing a demo yesterday and needed a quick and dirty way to generate some XML so I wrote the function below. This highlights a couple of changes that are coming up in CTP3 that I thought I would preview. 1) The keyword "cmdlet" is going away and we'll just have "function". Notice that now you...
Page 1 of 1 (15 items)