[NoBrainer] Start-Sleep takes longer that it seems

While doing some tests with our new TraceListener and log server I did some tests where I wanted to find out how long the log server would take to start accepting messages. So I started to constantly send messages from the console: When I looked at the server logs I noticed that the arriving messages […]

How to Write a PowerShell Binary Module – revisited

Module Configuration Variable

Recently I started writing a PowerShell binary module in C# (mainly due to facilitate testing and move away from Pester limitations). In this post I will describe the format of our PowerShell module and the format of the respective Cmdlets, plus logging and testing integration. My first attempt was to create a module for Abiquo […]

Logging in PowerShell with System.Diagnostics.TraceSource and log4net

Microsoft .NET offers a very flexible logging system exposed via the System.Diagnostics namespace. Unfortunately (and not surprisingly), by default the pre-packaged listeners do not support writing messages to log4net directly. However, we can extend the logging outputs by implementing custom TraceListeners and when asking our favourite search engine for “TraceListener log4net” we find there are […]

[HOWTO] Set up PowerShell Remote Session Configuration

Todays blog post is about setting up a PowerShell remote session configuration on a Windows machine. A PowerShell remote session configuration can be used when connecting from another machine (hereinafter called as Client) to the machine the PoSH remote session configuration resides on (hereinafter called as Target) using Enter-PSSession Cmdlet. A PoSH remote session configuration […]

[HOWTO] Automatically applying PSDefaultValue to C# based PSCmdlet Parameters

One of the cool features of PowerShell script based Cmdlets is the possibility to define default values for Cmdlet parameters. This is typically done like this: Whenever we invoke such a Cmdlet without specifying the Name parameter the PowerShell runtime will insert the value my default value into that parameter. C# based PSCmdlet provide a […]

Unit Testing C# binary PowerShell Modules

For years all our PowerShell modules we released were script modules (i.e. they were written in PowerShell). However, it is certainly possible to write PowerShell modules in C# as binary modules. Of course there are already plenty discussions whether one or the other approach is better. It really depends on the exact requirements. For us […]

Backward Compatible Tags in PowerShell 5 Module Manifest

A few months ago we started to publish our PowerShell modules to PowerShellGallery. PowerShellGallery visualizes the PSData defined in PrivateData of module manifest, which got introduced in PowerShell 5. PrivateData part of a module manifest file created with the New-ModuleManifest Cmdlet of PowerShell 5. Because of that we extended the module manifest files of our […]

[NoBrainer] Getting constructor information with PowerShell 5 easily

Before PowerShell 5 we had to revert to reflection to be able to display constructor information in PowerShell (see Get-Constructor Fun for details). And because we used that functionality so often we created a Cmdlet Get-Constructor that is part of our biz.dfch.PS.System.Utilities module. However with PowerShell 5 this is obsolete as it is now built […]

Windows PowerShell on Linux Ubuntu 14.04

Microsoft finally open sourced and ported Windows PowerShell to Linux. As we use Windows PowerShell quite often in our daily business we decided to check out and test PowerShell on Linux. I was the happy one, who got the task to try it out. Setup For the try out I created a new virtual machine […]

[HOWTO] Analyze PowerShell Scripts with PSScriptAnalyzer

A few weeks ago we started publishing our PowerShell modules to PowerShell Gallery. After publishing the module biz.dfch.PS.Appclusive.Client the first time we got an email from PowerShell gallery with some code analysis results with severity Error. As written in the email the analysis was performed with a module called PSScriptAnalyzer. We considered the project description […]