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 […]