FileContents contains DSC resources for managing file content as features by the underlying DSC resource.
Source |
|
DSC Resource |
|
Documentation |
Parameter | DataType | Description |
---|---|---|
hashtable[] |
This parameter is used to add, set or clear entries in Windows INI settings files (see IniSettingsFile) |
|
hashtable[] |
The parameter is used to add, remove or set key/value pairs in a text file containing key/value pair entries (see KeyValuePairFile) |
|
hashtable[] |
This parameter is used to replace strings matching a regular expression in a text file (see ReplaceText) |
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
Path |
Key |
String |
The path to the INI settings file to set the entry in. |
|
Key |
Key |
String |
The section to add or set the entry in. |
|
Section |
Key |
String |
The section to add or set the entry in. |
|
Type |
String |
Specifies the value type that contains the value to set the entry to. Defaults to 'Text'. |
|
|
Text |
String |
The text to set the entry value to. Only used when Type is set to 'Text'. |
||
Secret |
PSCredential |
The secret text to set the entry value to. Only used when Type is set to 'Secret'. |
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
Path |
Key |
String |
The path to the key value pair text file. |
|
Ensure |
String |
Specifies the if the key value pair with the specified key should exist in the file. |
|
|
Type |
String |
Specifies the value type to use as the replacement string. Defaults to 'Text'. |
|
|
Text |
String |
The text to replace the value with in the identified key. Only used when Type is set to 'Text'. |
||
Secret |
PSCredential |
The secret text to replace the value with in the identified key. Only used when Type is set to 'Secret'. |
||
IgnoreNameCase |
Boolean |
Ignore the case of the name of the key. Defaults to |
||
IgnoreValueCase |
Boolean |
Ignore the case of any text or secret when determining if it they need to be updated.
Defaults to |
||
Encoding |
String |
Specifies the file encoding. Defaults to ASCII. |
|
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
Path |
Key |
String |
The path to the text file to replace the string in. |
|
Search |
Key |
String |
The RegEx string to use to search the text file. |
|
Type |
String |
Specifies the value type to use as the replacement string. Defaults to 'Text'. |
|
|
Text |
String |
The text to replace the text identified by the RegEx. Only used when Type is set to 'Text'. |
||
Secret |
PSCredential |
The secret text to replace the text identified by the RegEx. Only used when Type is set to 'Secret'. |
||
AllowAppend |
Boolean |
Specifies to append text to the file being modified. Adds the ability to add a configuration entry. |
||
Encoding |
String |
Specifies the file encoding. Defaults to ASCII. |
|
FileContents:
IniSettingsFiles:
- Path: C:\MyApp\MyApp.ini
Section: Logging
Key: Level
Text: Information
- Path: C:\MyApp\MyApp2.ini
Section: Database
Key: ConnectionString
Type: Secret
Secret: "[ENC=PE9ianMgVmVyc2lvbj0iMS4xLjAuMSIgeG1sbnM9...=]"
KeyValuePairFiles:
- Path: C:\MyApp\MyApp.conf
Name: Core.Logging1
Ensure: Absent
- Path: C:\MyApp\MyApp.conf
Name: Core.Logging2
Ensure: Present
Text: Information
- Path: C:\MyApp\MyApp.conf
Name: Core.Password
Ensure: Present
Type: Secret
Secret: "[ENC=PE9ianMgVmVyc2lvbj0iMS4xLjAuMSIgeG1sbnM9...=]"
ReplaceTexts:
- Path: c:\inetpub\wwwroot\default.htm
Search: "%secret%"
Type: Secret
Secret: "[ENC=PE9ianMgVmVyc2lvbj0iMS4xLjAuMSIgeG1sbnM9...=]"
- Path: c:\inetpub\wwwroot\default.htm
Search: "%appname%"
Type: Text
Text: Awesome App
- Path: c:\inetpub\wwwroot\default.htm
Search: <img src=['`\"][a-zA-Z0-9.]*['`\"]>
Type: Text
Text: <img src="imgs/placeholder.jpg">
Datum.yml
(Excerpt)lookup_options:
FileContents:
merge_hash: deep
FileContents\IniSettingsFiles:
merge_hash_array: UniqueKeyValTuples
merge_options:
tuple_keys:
- Path
- Section
- Key
FileContents\KeyValuePairFiles:
merge_hash_array: UniqueKeyValTuples
merge_options:
tuple_keys:
- Path
- Name
FileContents\ReplaceTexts:
merge_hash_array: UniqueKeyValTuples
merge_options:
tuple_keys:
- Path
- Search