• 9 Aug 2012

    Why PowerShell had Better be on Your Resume

    From Twitter: " A couple guys went to other opp- and ALL said Posh = key to better pay and new job Its a fact Learn it" Couldn't agree more. Pair that up with a longer conversation I had with a long-time colleague, who now - after more than ten years in his job - finds himself brushing up his resume. His company, like many others, is going to try the old IT outsourcing routine. He may get to keep his...
    • 8 Aug 2012

    Bummed ABout All the Cool PowerShell v3 Stuff You Can't Use?

    I keep cautioning people that, while PowerShell v3 is cool-awesome-rockin, much of its greatness actually comes from the OS on which it runs. I mean, nobody really wakes up in the morning saying, "man, I can't wait to filter some stuff using Where-Object today," do they? No... we go to work and have to do our jobs. And those jobs often require automation. And that automation is usually provided, not by PowerShell...
    • 31 Jul 2012

    Troubleshooting Pipeline Parameter Binding by Peeking Inside

    Over at Windows IT Pro , I recently posted an article on how to use Trace-Command to troubleshoot pipeline parameter binding. Several folks asked for a more detailed tutorial... so here ya go. Why doesn't this command work? get-adcomputer - filter * | select @{n = 'computername' ;e = { $_ . name }} | invoke-command -ScriptBlock { dir } Well, let's perhaps start with the obvious. My best troubleshooting...
    • 19 Jul 2012

    Measure PowerShell Performance

    I'm often asked by folks if there's a "better way" to do something in a script. Often times, they're looking for a better procedural approach - following best practices like object-based output, for example. But sometimes, they're looking for better performance from a script or command. Well, the good news is that PowerShell itself can help with that. Let's consider two short scripts that...
    • 9 Jul 2012

    Release Dates for PowerShell 3 announced!

    Microsoft has just announced, at its Worldwide Partner Conference, that Windows 8 and Windows Server 2012 are on track to hit "Release to Manufacturing" the first week of August, with general product availability in October. That means PowerShell v3 will start becoming available in August-September; we can expect v3 to be available as a Web download for older versions of Windows probably by December (based on...
    • 19 Jun 2012

    TechEd PowerShell Sessions

    Many sessions are now available on Channel 9 as recordings... First, mine: Crash Course w/Jeffrey Snover (one of the conference's top-rated overall sessions) Crash Course repeat Building Reusable PowerShell Tools Remoting in Depth (another top-rated session!) But wait, there's more! App-V 5 and PowerShell Win2012 Multi-Server Management Advanced Automation in PSH 3 ...
    • 19 Jun 2012

    [UPDATED] Snover School: FANCY Wildcards

    So, I'd previously posted about a cool trick Jeffrey Snover demonstrated at TechEd: Get-Service -Name [a-b]* This will return a list of all services whose names start with A or B. Now for me, this was a cool trick: I didn't realize that wildcards could be more than * or ?! And Snover described these as "rich regular expressions." Well, not exactly. We've corresponded, and what's actually...
    • 14 Jun 2012

    Sample Code from my TechEd "Building Reusable PowerShell Tools" Session

    Hey, all! I was looking over the script I'd saved from this TechEd session, and realized I could offer something better. Go to the Web page for my upcoming "Toolmaking" book . In the Downloads section, grab the book's code samples. You'll actually get a better example than I showed in class, and it goes further. The listings for Chapter 13 pretty much put you where that session wraps up. Now...
    • 14 Jun 2012

    How To Use Write-Host Without Endangering Puppies (or, A Manifesto for Modularizing PowerShell Scripts)

    At this week's TechEd, I was speaking with Jeffrey Snover in the hallway on Wednesday when he remarked, "you know, Write-Host isn't all bad." After he got someone to come around with smelling salts to revive me, he elaborated, "so long as your verb is Show." I started to object - and then a subtle, yet brilliant light came upon me. He's write. Heh. But, seriously, if you do three...
    • 7 Jun 2012

    Using PowerShell to Scrape the Web

    One of the things administrators often look to do with PowerShell is "scrape" Web pages. In the past, you had a couple of options: Use Internet Explorer's COM object (which can get a bit fugly), or use the .NET Framework's WebRequest stuff (slightly less fugly, but still a bit). PowerShell v3 to the rescue. Microsoft has wrapped much of the fugly in some cool and simple cmdlets, and given PowerShell...
    • 4 Jun 2012

    [UPDATED] Tweaks to PowerShel v3 Updatable Help

    I've written before about how PowerShell v3 won't come with help "in the box," but will instead require you to download help from Microsoft's servers. ASIDE: Technically, any module author can provide updatable help on their own Web server; you just have to tag your module manifest with the appropriate information so that PowerShell can locate your online content and download it. Now that Windows...
    • 18 May 2012

    Awesome Use of PowerShell

    I recently moderated a Webinar for VMware, about their vCenter Protect Essentials Plus product (formerly a Shavlik product). Awesome PowerShell integration. So basically, this product (which I shall henceforth call vCPEP) is like System Center Configuration Manager. It inventories your systems, deploys patches (their big schtick is that they handle non-MS patches in a very integrated way, rather than just doing MS...
    • 10 May 2012

    Setting up Remoting via GPO (need tech reviewers!)

    I'm writing an addition chapter for the free " Secrets of PowerShell Remoting " book, and I'd like folks to fact-check the attached draft (if you're getting this via RSS feed, it's in the Enclosure; if you're looking at the Web site, it's at the very bottom and easy to miss). Basically, this walks you through using GPO to set up all possible aspects of Remoting on a Windows system...
    • 7 May 2012

    PowerShell Performance: It's the DLR

    Understanding some of PowerShell's guts requires a pretty deep dive into the .NET Framework upon which the shell is built. In PowerShell v1 and v2, the shell was built upon the Common Language Runtime, or CLR, just like every other .NET application. The CLR is vaguely like Oracle's Java Virtual Machine: It's the runtime in which all .NET code runs. When you code in C#, your code is "compiled"...
    • 26 Apr 2012

    Free "Secrets of PowerShell Remoting" Now Available

    It's done - the first edition at least! Thanks to Tobias Weltner for his contribution to the guide, and to Aleksander Nikolic for the tech-edit pass. Grab your copy today - you'll find links to free PDF and EPUB versions. Amazon for some reason won't let me put the book in as free, so it's "under review" in their system with a $.99 price. If anyone knows of a DOCX > MOBI converter (especially...
    • 25 Apr 2012

    [UPDATED] WinForms. WPF. WTF.

    So, I need some feedback. I'm in the middle of planning a book on PowerShell scripting and toolmaking (my favorite new gerund, and more descriptive, I feel, than scripting ). One of the things I want to cover is building GUI tools in PowerShell. And I become torn. On the one hand, there's WinForms. It's pretty easy to use, even if you're hand-coding it, and there's always commercial products...
    • 25 Apr 2012

    What Security Objections Does Remoting Raise?

    Let's say you went to your organization and said, "hey, I want to enable PowerShell Remoting on all of our computers. Today." What objections would be raised? I'm asking you to be specific here. I know there are objections and questions - but I want to be clear on exactly what they are. I'm writing a managerial-level guide to Remoting operations and security, and I want to answer those questions...
    • 24 Apr 2012

    Remember: PowerShell v3 isn't Necessarily 100% v2-Compatible. Sorta.

    Here's an error message I'm looking forward to seeing a lot of: Import-Module : Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. This came from a recently asked question in my Ask the Experts forum, and I wanted to share it here because I expect it'll come up a lot in the future. Don't...
    • 24 Apr 2012

    Remote PowerShell Debugging

    So, one of the things I've been seeing float through my mailbox lately is the phrase "Remote PowerShell Debugging." It's mainly been in relation to a recent PowerShell-related product announcement from an ISV. Great product, no question, but I've gotten a ton of follow-up emails from colleagues about that particular feature. "They're saying they're the only ones who do remote debugging...
    • 23 Apr 2012

    v3: Unrolling What's Been Rolled

    Computer terminology is fun. Especially developer terminology. Especially especially early-in terminology that hasn't yet gone through marketing and legal ;). Consider this PowerShell v2 example (and before you say it, yes, I know Stop-Process would make a lot more sense for this... it's just an illustration!): $processes = Get-Process -Name note* $processes.Kill() This is a basic approach I see people...
    • 23 Apr 2012

    PowerShell v3: Not as Feature-Laden as You Think?

    Now that Microsoft's finally been able to start officially talking about v3, folks are getting even more excited. Amazing new features... workflow... simplified syntax... updatable help... complete cmdlet coverage... Slow down, tiger. Although folks tend to gush about it all in one breath, there are a few facts to keep in mind. First, only some of what you're hearing about PowerShell v3 is considered "core...
    • 20 Apr 2012

    2012 Scripting Games Commentary: Try to Write Semantically Sensible Commands

    "Semantics" generally refers to the "meaning" or "sense" of something. Take this line from a recent Scripting Games entry: if ( Test-Connection $ComputerName ) Don't like it. Why? Well, because the code implies that Test-Connection is returning a True/False value. It isn't - you must include its -Quiet switch for that. It's returning a...
    • 20 Apr 2012

    Free Guide: Secrets of PowerShell Remoting

    I've been getting a lot of questions about some of PowerShell Remoting's trickier configuration scenarios - so many that I decided to sit down and figure it all out, documenting every step of the way. With some help from a CloudShare 6-machine virtual environment, consisting of two forests and a standalone machine, I've gotten off to an awesome start. The result is the first draft of Secrets of PowerShell...
    • 19 Apr 2012

    2012 Scripting Games Commentary: Those Who Forget The Past...

    This is the best line I think I've seen in this year's Scripting Games: if ((net localgroup Administrators | Where { $_ -eq $env:username }) -eq $null ) { Why? Because it forgoes digging into the .NET Framework. It doesn't try a hack-y approach to figuring out if the current user is an administrator. It just fires off good old Net.exe, a utility we've used for...
    • 18 Apr 2012

    2012 Scripting Games Commentary: Think About What You're Doing

    Consider this code snippet from a Scripting Games entry (I've changed the code a bit - you won't be able to use this to derive a correct answer! Also, this is a snippet , so it won't run as-is): foreach ( $computer in $computername ) { try { Get-WmiObject -ComputerName $computer -Class win32_service -Credential $cred | %{ $Object = New-Object PSObject -Property @{ Computer...