Skip to content

Powershell

Sergey Zwezdin edited this page Jun 18, 2016 · 3 revisions

Powershell is a very popular, flexible and easy to use scripting tool based on .NET.

Magic Chunks have integrated Powershell aliases to use it inside your Powershell scripts. To use it download latest release manually or get it directly from Nuget.

Steps to setup config transformations at Powershell scripts:

Step 1: Import MagicChunks.psm1 module:

Import-Module ".\MagicChunks.psm1";

Step 2: Add Format-MagicChunks command call to your Powershell script:

Format-MagicChunks -path "$PSScriptRoot\Web.config" `
    -target "$PSScriptRoot\Web.transformed.1.config" -transformations @{
       "configuration/system.web/authentication/@mode" = "Forms";
       "configuration/system.web/httpRuntime" = "125";
}

Format-MagicChunks command

Format-MagicChunks command have following parameters:

  • path − path to source file.
  • target − path to target file (default value: same as path parameter).
  • type − type of document: Xml, Json, Yaml and so on (default value: auto - library will detect document type automatically).
  • trasformations − key-valued collection of transformations.

You can find complete sample powershell script here.