PowerShell 0

[HOWTO] Access Microsoft Access Database with PowerShell

In one of our current projects we had to access a Microsoft Access Database (.mdb) with PowerShell. I first tried to access the .mdb using the Invoke-SqlCmd Cmdlet from our PowerShell module biz.dfch.PS.System.Data. Unfortunately connecting to the Access database with the Invoke-SqlCmd Cmdlet does not work as it uses SqlClient from the C#/.NET namespace System.Data under the hood. After a […]

C#/.NET 4

Manual JWT Validation against Azure Active Directory

For our current WebApi project we decided to implement OAuth2 authentication with Azure Active Directory. As our API needs to support other authentication mechanisms like Basic and Negotiate beside OAuth2 we implemented multiple authentication filters that, where each filter is responsible for a specific authentication mechanism. One of these authentication filters, the BearerAuthenticationFilter, is responsible to handle requests that contain […]

C#/.NET 0

Get NetworkCredential from PSCredential splits Username into Username and Domain

During development of a PowerShell binary module I had to do deal with two different credential types (System.Management.Automation.PSCredential and System.Net.NetworkCredential) and came across a behaviour I wanted to write down. The PowerShell binary module I developed contains several Cmdlets. One of them defines a parameter of type System.Management.Automation.PSCredential. Inside the Cmdlet we need to have an object of type System.Net.NetworkCredential. […]

C#/.NET 0

[HOWTO] Set Cookie Header on DefaultRequestHeaders of HttpClient

For one of our customers we had to implement Cookie handling for authentication purposes. This means reading the session token out of the Set-Cookie header and send the session token in the Cookie header of every request. When using the HttpClient from System.Net.Http there are two possibilites to do that. Either by passing a HttpClientHandler with a CookieContainer to the […]

PowerShell 0

[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 allows you to define under […]

PowerShell 0

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 existing modules with the PrivateData […]

PowerShell 0

[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 and documentation at GitHub and […]

C#/.NET 0

[NoBrainer] PUT/PATCH/MERGE with OData Service Client

Visual Studio supports the generation of data service clients (Service references) for OData services. A data service client is a .NET class that contains methods for accessing the OData service and gets generated based on the metadata provided by the OData service. The client acts as a proxy and translates the method calls into HTTP requests. Mike Wasson describes in […]

C#/.NET 0

[HOWTO] Execute C# build from PowerShell on Jenkins

At d-fens we usually use JetBrains TeamCity as a build server. Because one of our customers uses Jenkins as build server I had the chance to set up a build job for one of our C#/.NET projects on Jenkins. The project I mentioned is a C#/.NET Web Application built with Visual Studio 2013. For testing we make use of the […]

Various Products 0

Apply Commit from one Repository to another

Imagine you have several repositories holding more or less the same code base that only differ in some customer specific functionality. At d-fens we had exactly the before described situation. We made some changes (i.e. new features or bugfixes) to one of the repositories and wanted to apply the changes to the second repo. One possibility is to apply all […]

PowerShell 3

[HOWTO] Sign PowerShell Script with SuisseID

We at d-fens all have a SuisseID, which can be used for different purposes like authentication and electronical signing purposes. It’s as well possible to sign code with the SuisseID. The advantages of using the SuisseID for code signing are that the SuisseID is a very cheap in comparison to other code signing certificates and that the user gets authenticated […]

PowerShell 0

GitHub Repository creation with PowerShell

In the last few weeks I had to create several GitHub repositories for my daily work. To simplify the process I automated the creation with PowerShell. I created and initialized the repositories manually until I recognized that this is a perfect task to automate. First I studied the documentation of the GitHub API v3, which is very well documented! Fortunately […]