en-US/about_KeyValuePairFile.help.txt

.NAME
    KeyValuePairFile
 
# Description
     
    The KeyValuePairFile resource is used to add, remove or set key/value pairs
    in a text file containing key/value pair entries.
     
    This resource is intended to be used to set key/value pair values in
    configuration or data files where no partitions or headings are used to
    separate entries and each line contains only a single entry.
     
    This resource should not be used to configure INI files.
    The [IniSettingFile](IniSettingFile.md) resource should be used instead.
     
.PARAMETER Path
    Key - String
    The path to the key value pair text file.
 
.PARAMETER Name
    Key - String
    The name of the key.
 
.PARAMETER Ensure
    Write - String
    Allowed values: Present, Absent
    Specifies the if the key value pair with the specified key should exist in the file.
 
.PARAMETER Type
    Write - String
    Allowed values: Text, Secret
    Specifies the value type to use as the replacement string. Defaults to 'Text'.
 
.PARAMETER Text
    Write - String
    The text to replace the value with in the identified key. Only used when Type is set to 'Text'.
 
.PARAMETER Secret
    write - String
    The secret text to replace the value with in the identified key. Only used when Type is set to 'Secret'.
 
.PARAMETER IgnoreNameCase
    Write - Boolean
    Ignore the case of the name of the key. Defaults to $False.
 
.PARAMETER IgnoreValueCase
    Write - Boolean
    Ignore the case of any text or secret when determining if it they need to be updated. Defaults to $False.
 
.PARAMETER Encoding
    Write - String
    Allowed values: ASCII, BigEndianUnicode, BigEndianUTF32, UTF8, UTF32
    Specifies the file encoding. Defaults to ASCII
 
PSScriptInfo
.VERSION 1.0.0
.GUID d326f0fb-b169-4602-a508-dbcb07d0e883
.AUTHOR Daniel Scott-Raynsford
.COMPANYNAME
.COPYRIGHT (c) 2018 Daniel Scott-Raynsford. All rights reserved.
.TAGS DSCConfiguration
.LICENSEURI https://github.com/PlagueHO/FileContentDsc/blob/master/LICENSE
.PROJECTURI https://github.com/PlagueHO/FileContentDsc
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES First version.
.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core
 
 
#Requires -module FileContentDsc
 
 
    .DESCRIPTION
    Remove all `Core.Logging` keys in the file `c:\myapp\myapp.conf`.
 
Configuration KeyValuePairFile_RemovePlainTextPair_Config
{
    Import-DSCResource -ModuleName FileContentDsc
 
    Node localhost
    {
        KeyValuePairFile RemoveCoreLogging
        {
            Path = 'c:\myapp\myapp.conf'
            Name = 'Core.Logging'
            Ensure = 'Absent'
        }
    }
}
 
PSScriptInfo
.VERSION 1.0.0
.GUID 81ab6eb0-3052-46cd-bea5-653e89d38972
.AUTHOR Daniel Scott-Raynsford
.COMPANYNAME
.COPYRIGHT (c) 2018 Daniel Scott-Raynsford. All rights reserved.
.TAGS DSCConfiguration
.LICENSEURI https://github.com/PlagueHO/FileContentDsc/blob/master/LICENSE
.PROJECTURI https://github.com/PlagueHO/FileContentDsc
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES First version.
.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core
 
 
#Requires -module FileContentDsc
 
 
    .DESCRIPTION
    Set all `Core.Logging` keys to `Information` or add it
    if it is missing in the file `c:\myapp\myapp.conf`.
 
Configuration KeyValuePairFile_SetPlainTextPair_Config
{
    Import-DSCResource -ModuleName FileContentDsc
 
    Node localhost
    {
        KeyValuePairFile SetCoreLogging
        {
            Path = 'c:\myapp\myapp.conf'
            Name = 'Core.Logging'
            Ensure = 'Present'
            Text = 'Information'
        }
    }
}
 
PSScriptInfo
.VERSION 1.0.0
.GUID 89fa6d5d-c121-4502-8bac-5d3ea66e8e80
.AUTHOR Daniel Scott-Raynsford
.COMPANYNAME
.COPYRIGHT (c) 2018 Daniel Scott-Raynsford. All rights reserved.
.TAGS DSCConfiguration
.LICENSEURI https://github.com/PlagueHO/FileContentDsc/blob/master/LICENSE
.PROJECTURI https://github.com/PlagueHO/FileContentDsc
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES First version.
.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core
 
 
#Requires -module FileContentDsc
 
 
    .DESCRIPTION
    Set all `Core.Password` keys to the password provided in the $Secret
    credential object or add it if it is missing in the file `c:\myapp\myapp.conf`.
 
Configuration KeyValuePairFile_SetSecretTextPair_Config
{
    param
    (
        [Parameter()]
        [ValidateNotNullorEmpty()]
        [PSCredential]
        $Secret
    )
 
    Import-DSCResource -ModuleName FileContentDsc
 
    Node localhost
    {
        KeyValuePairFile SetCorePassword
        {
            Path = 'c:\myapp\myapp.conf'
            Name = 'Core.Password'
            Ensure = 'Present'
            Type = 'Secret'
            Secret = $Secret
        }
    }
}