The Vexasoft PowerShell Blog

PowerShell script for installing Mercurial 2.9 on IIS 8.5 / 2012 R2

So, I really like Mercurial. It's my source control tool of choice, but setting it up on IIS can be a pain. There aren't a whole heap of docs out there (at least not that I found), so you're left mostly piecing together blog posts from various older versions until you can build up a working config. However, using this script you can have a working Mercurial 2.9 server up in minutes.


PowerShell 4 Desired State Configuration - Enforce NTFS permissions

By now you've probably heard of PowerShell 4 Desired State Configuration. If not, we'll have some tutorials up for you soon, but in the meantime if you are a DSC convert and you've got access to Server 2012 R2, here's a brand new module to allow you to enforce NTFS permissions on a target computer.

Note: This module requires the release version of PowerShell 4 - not the CTP. So if you don't have access to Windows 8.1 or Server 2012 R2 you're out of luck until the official release.

So, this module allows you to enforce NTFS permissions on files and folders on the target computer. Eventually this and all our other desired state modules will be going into the PowerShell.Org DSC modules project - if you haven't had a look yet, check it out.


Recording NTFS permissions with PowerShell

I was talking to someone this morning about custom file system auditing to overcome a very specific problem and, inspired by that, this is a quick blog post to demonstrate how you can record file system rights using PowerShell.

The Export-NTFSPermissions function below will record the NTFS access rules in your file system and export them to CSV, allowing you to build up a picture of the entire set of permissions that have been assigned within a drive or folder. PowerShell being PowerShell, you can then re-import the CSV to query, manipulate or even re-apply the data whenever you need to.


PowerShell Tutorial – Try Catch Finally and error handling in PowerShell

One of the key parts of any good PowerShell script is error handling. Even in the shortest script, being able to handle errors helps to ensure that an unexpected event will not go on to wreck the system you are working on. Take the example below. Every week in our sample company (MyCompany.Com) Human Resources are going to upload a list telling us who should have access to the Expenses database. If a name isn’t in the list from HR we’re going to remove it from the group and that user will no longer be able to log expense claims: 


New versions of the Cmdlet Library are out now with Windows 8 and PowerShell 3 support

It’s a double update this week. Two versions of PowerShell means two versions of the Cmdlet Library.

For all you pioneers toiling away in the benevolent wilds of PowerShell 3.0, we have version 3.0 of the Library. Updated to run with .Net 4 and including support for Windows 8 and Server 2012, version 3 contains all the commands and functionality of the existing Cmdlet Library built for a PowerShell 3 environment. Purchased Cmdlet Library 2 licenses continue to be valid for version 3 when installed on the currently licensed operating system. If you’re doing an OS reinstall you’ll need a new key, which we’ll be sending out this week. You can also contact support if you run into any difficulties. 

For those of you still comfortably ensconced in the familiar bosom of PowerShell 2.0 we also have version 2.8 of the Library. It’s all the same functionality as version 3, including Windows 8 support, but built for PowerShell 2. Version 2.8 is the last major update of Cmdlet Library 2 – any new commands and features will be going into version 3 from now on.

And, speaking of new commands, two new cmdlets have been added to the Library: