We’ve recently been discussing the possibility of hosting a build environment for the PowerShell community. For those who are unfamiliar with the benefits, such an environment allows you to do things like: Automatically run a suite of tests when new code is checked into source control. These tests can be run on multiple operating systems or versions of PowerShell concurrently. Publish pass/fail information back to your source control repository for each tested commit. Automatically release code which passes your tests to repositories such as Chocolatey or PowerShellGet, etc. However, such an environment would require some amount of cloud resources, and those […]
The nominations are in, and the votes are tallied! PowerShell Heroes is our way of recognizing the people who are making significant contributions to the PowerShell community, but who haven’t received any other formal recognition (such as Microsoft’s MVP Award). In many cases, these are the rising stars we hope to see receive an MVP someday, but in all cases they’re out there, working hard to make a difference. They were nominated by their peers, and selected by the 2014 PowerShell Hero honorees. We’ve got nine PowerShell Heroes this year, so without further ado: $heroes | Get-Random -Count $heroes.Count Stéphane […]
It’s that time of year again: we’re looking for nominations for new PowerShell Heroes! The PowerShell Hero program is our way of giving recognition to people who are contributing to the PowerShell community, but who have not yet received some other similar award, such as Microsoft’s MVP or VMware’s vExpert. This will be the second year for the program; in January of 2014, we recognized Teresa Wilson, Mark Schill, Francois-Xavier Cat, Martin Pugh, and Dave Wyatt. We will be accepting nominations for the 2015 Heroes until December 15th, 2014. After that date, we will go over the nominations, and the honorees will be […]
I came across an interesting problem today while working on the Pester module: how do you create a proxy function for a Cmdlet which has dynamic parameters? I needed a solution which would automatically reproduce the original cmdlet’s dynamic parameters inside a PowerShell function, and which would work on PowerShell 2.0 if at all possible. The full post and solution can be found on my blog at http://davewyatt.wordpress.com/2014/09/01/proxy-functions-for-cmdlets-with-dynamic-parameters/. Related posts: PowerShell Gotcha: UNC paths and Providers PowerShell and System.Nullable<T> Tracking down commands that are polluting your pipeline
Recently on the PowerShell.org forums, a community member mentioned that they were having trouble setting up a Server 2008 R2 machine as a DSC pull server. It turns out, this is possible, but you have to install all the prerequisites yourself, since the Add-WindowsFeature DSC-Service command doesn’t do it for you on the older operating system. Refer to this blog post for the checklist. Related posts: Building a Desired State Configuration Pull Server Building a Desired State Configuration Configuration – Part 2 Configuring a Desired State Configuration Client Building Scalable Configurations With DSC
In a recent forum post, someone was having trouble with a function that was outputting more values than he expected. We’ve all been there. He was having trouble debugging this, and I decided to see if I could find a way to narrow down the search in an automated fashion, rather than having to step through the code by hand. The full article and code are up on my blog at http://davewyatt.wordpress.com/2014/06/05/tracking-down-commands-that-are-polluting-your-pipeline/ Related posts: Saving Passwords (and preventing other processes from decrypting them) PowerShell Gotcha: UNC paths and Providers Working on a new PowerShell module: ProtectedData Proxy Functions for Cmdlets […]
I’m working on a new module intended to make it easier to encrypt secret data, and share it among multiple users and computers in a secure fashion. It’s not quite ready for “release” yet, but I’ve made it public on GitHub anyway, so I can start to get feedback early. Check out my original blog post (link) for details. The GitHub repository is here. Related posts: PowerShell Gotcha: UNC paths and Providers PowerShell and System.Nullable<T> Cmdlets or Advanced Functions? Tracking down commands that are polluting your pipeline
A couple weeks ago, some malicious PowerShell code was discovered in the wild, dubbed the “Power Worm” in the Trend Micro article that originally publicised the malware. Matt Graeber has done a great analysis of the code on his blog. In the comments for that blog post, we started discussing some options for locking down PowerShell, preventing it from being used in this type of attack. (Unfortunately, Execution Policy is currently no barrier at all; PowerShell.exe can simply be launched with the -Command or -EncodedCommand parameters, bypassing ExecutionPolicy entirely.) Matt’s idea is to have PowerShell run in Constrained Language mode […]
I’ve posted a poll to get a feel for the PowerShell community’s preference on this. Compiled Cmdlets offer much better performance than the equivalent PowerShell advanced function, which can be a very valuable thing if you need to process large sets of data in your scripts. The other side of that coin is that in order to make changes or review the code of a Cmdlet, you need to start working with C# (and likely Visual Studio as well.) Which do you feel is more important when downloading a module: performance, or sticking with familiar PowerShell code? The poll is […]
While reading today’s “Hey, Scripting Guy!” blog post by Boe Prox, I learned that it is possible to have multiple threads / runspaces accessing the same live objects in a PowerShell session, something I had previously thought was not possible. Seeing that, I decided to write a “lock” statement for PowerShell, which can be necessary in some circumstances. See the original blog post for the function and more information. No related posts.
While helping to answer a question about Exchange cmdlets today, I came across something interesting, which doesn’t seem to be very well documented. A little background, first: in the .NET Framework (starting in Version 2.0), there’s a Generic type called System.Nullable<T>. The purpose of this type is to allow you to assign a value of null to Value types (structs, integers, booleans, etc), which are normally not allowed to be null in a .NET application. The Nullable structure consists of two properties: HasValue (a Boolean), and Value (the underlying value type, such as an integer, struct, etc). A C# method […]
PowerShell’s behavior can be a little bit funny when you pass a UNC path to certain cmdlets. PowerShell doesn’t recognize these paths as “rooted” because they’re not on a PSDrive; as such, whatever provider is associated with PowerShell’s current location will attempt to handle them. For example: Set-Location C: Get-ChildItem -Path \\$env:COMPUTERNAME\c$ Set-Location HKLM: Get-ChildItem -Path \\$env:COMPUTERNAME\c$ The first command works fine (assuming you have a c$ share enabled and are able to access it), and the second command gives a “Cannot find path” error, because the Registry provider tried to work with the UNC path instead of the FileSystem […]
Back in November, I made a post about saving passwords for your PowerShell scripts. As I mentioned in that article, the ConvertFrom-SecureString cmdlet uses the Data Protection API to create an encrypted copy of the SecureString’s contents. DPAPI uses master encryption keys that are saved in the user’s profile; unless you enable either Roaming Profiles or Credential Roaming, you’ll only be able to decrypt that value on the same computer where the encryption took place. Even if you do enable Credential Roaming, only the same user account who originally encrypted the data will be able to read it. So, what […]
There was quite a bit of interest in the upcoming free Error Handling ebook during the PowerScripting Podcast on Thursday. It’s still in a very early draft form, but I’ve posted it to the GitHub repository for anyone who wants to brave the unedited waters and get a preview of the content. Feedback is welcome, particularly on the technical content. Don’t worry about the presentation / organization so much, as those are likely to change once we go through a review and edit process anyway. You can post comments on GitHub, or contact me directly at email@example.com. No related posts.
Hello everyone, As you may know from past experience or from reading the Forums Tips and Guidelines sticky, there are a couple of quirks with the forum software we’re using here related to CODE tags and backtick characters. The forum software treats backticks as special characters, which is quite annoying if your code contains any of them, and you’ll find that using PRE tags will give you much better results than CODE, particularly if someone tries to copy and paste your code into another window. I’ve added a function to my PowerShell ISE profile which avoids these headaches by taking […]