Adding Script Repository to PeetersOnline.nl

In an attempt to make PeetersOnline.nl even better ;) I am adding a Script Repository. It can be accessed through the button in the main navigation bar at the top of the site.

The Script Repository will soon hold all of my published Powershell scripts, formatted in a easy-to-use way, including a description, the syntax-highlighted code and a download link. This will not only allow you to more easily find and use my scripts, but will also leaves more room for the general blog section of PeetersOnline.nl to feature more in-depth explanations of how the scripts work.

I’m looking for your feedback to make this change a real improvement. So please comment either this post orĀ the main Script Repository page. I always read your comments.

I hope to hear from you soon.

Hugo Peeters

»crosslinked«

Regular Expression Magic in Powershell

I have been looking at regular expressions in Windows Powershell recently. Although it seems very complex, the power of regular expressions (regex) is worth the effort! Think about server naming conventions for example. It’s easy for a human to recognise a server name that begins with a location code and contains a status (Development, Test, Acceptance or Production) amongst other things. RegEx allows you to learn Powershell to recognise the same things.

The attached script contains a function that finds matches for a regular expresion and converts the named matches to object properties. Sounds complex? Take a look at this example for server names:

RegEx

If you can create the regular expression, this function does the matching and objectizing. It requires no modification at all for working with regular expressions that match other kinds of things, because you name the matching groups inside the regex definition. Cool stuff!

Obj-RegEx (Rename to .ps1)

Enjoy!

Hugo