A modern way to keep configuration in file
In Windows environment, we are so used to the INI file or configuration in XML format. You may consider a modern way to keep configuration in a file which uses JSON format. In Powershell,handling JSON format is quite easy ConvertTo-Json This method converts in object into JSON format. ConvertFrom-Json This method converts the JSON text to an object. The next recipe is to call Set-Content and Get-Content to update file and load from file respectively. We develop a simple configuration Powershell which handles the maintenance to the config file. Let's call this file config-my.ps1. param ( # list, add, set, delete [string]$axn, # the name of the setting to be updated. [string]$name, # new value [string]$value ) # validate user param if ($axn.Length -eq 0) { # default param $axn = "list" } elseif (($axn -eq "add") -or ($axn ...