[NoBrainer] Performance Considerations regarding using Guid.ToString vs Guid.Guid in PowerShell

While doing some performance optimisations on one our loader scripts I came across an issue of converting a System.Guid or [[Guid]] in PowerShell to a string representation. In C# I was always (and still am) using ToString() and never saw anything like a Guid property. However, for some reason in PowerShell I tended to use […]

[NoBrainer] Allman codestyle and gitignore for Java IntelliJ

The following xml-file describes the Allman code style for IntelliJ IDEA and the Java-File below shows an example of the code style. To import the settings to your IntelliJ IDEA go to Settings -> Settings -> Editor -> Code Style -> Java. Then click “Manage” and import the downloaded xml-file. For Java development I recommend […]

[NoBrainer] Enumerate all functions in a PowerShell script file via AST

Recently I needed to check if a function was defined inside a script file. Reflection was my first thought, and PowerShell being a first class .NET citizen should be able to perform this. But as PowerShell is defined as an Abstract Syntax Tree (AST) it is even easier to achieve this. Inside the AST every […]

[NoBrainer] Sending SMS to Clickatell via PowerShell

Some time ago I mentioned an error and a possible workaround when using PowerShell with the Clickatell SOAP interface. As Clickatell now provides a REST based interface I thought it is time to quickly show you how to use this API instead. Description When sending SMS you certainly first have to enable the REST API […]

[NoBrainer] Graylog2 AlertConditions based on field contents

This post describes how you can extend the Graylog2 AlertCondition mechanism to raise alerts based on the contents of a field (instead of just a message count or a field value). Introduction Currently Graylog2 only allows you to trigger AlarmCallbacks based on either MESSAGE_COUNT Here you define how many messages must be assigned to that […]

[NoBrainer] Sending Gelf messages to Graylog2 via PowerShell

Bulk loading data into Graylog2

Recently I was testing Graylog2 as a store for metering data and had to bulk-load a larger amount of data into its database. My goal was to create synthetic and randomised metric information for a couple of virtual servers (5’000) over a period of one year at a sampling rate of 5s. This would make […]

[NoBrainer] How to easily pass parameters to a script in a PowerShell job

Today I had to pass a long list of parameters to a Cmdlet inside a PowerShell job. At first it looked like this, which seemed rather horrbile (i.e. unreadable) to me. There had to be a cleaner approach to this – and so it was … there are some samples around the Internet on how […]

[NoBrainer] PowerShell modules, digital signatures, nuspec files and packages automated

As announced a couple of days ago we started pushing some of our PowerShell modules to GitHub and NuGet. And soon it became obvious that keeping all the scripts, signatures, versions and packages in sync was some tedious and error-prone work. This should definitely be automated, you might instantly think – and right you are! […]

[NoBrainer] Create C# extension methods via Add-Type and Update-TypeData in PowerShell

[Note] This is a rather old article from 2014. The world and PowerShell have changed. For an even easier way than presented here see the comment at the bottom of the article. In this post I present a quick refresher on how to make C# extension methods available to objects and classes in PowerShell sessions. […]

[NoBrainer] Help and Get-Help are not the same in PowerShell

This one bit me, when trying to convert the inline help of a PowerShell cmdlet into some markdown enriched code for Github. For the PowerShell modules and Cmdlet we publish at github we sometimes use the integrated Wiki pages from Github to have some documentation on their use. We often also extract the full inline […]