Get-SettingsFromFile
SYNOPSIS
Get settings for script
SYNTAX
1 2 |
|
DESCRIPTION
The Get-SettingsFromFile function looks for a file named globalSettings.json, a file named scriptName.json and for a object in globalSettings.json with same name as the script file invoking the function and returns a PSCustomObject with the combined settings.
If the same setting is found in multiple places the following priority is used:
- Scriptnamed object in globalSettings.json.
- scriptName.json.
- Global object in globalSettings.json.
Before returning the PSCustomObject all settings values are matched against the string 'globalValue'. If there is a match the value for the global settings with the same name will be used.
EXAMPLES
EXAMPLE 1
1 |
|
In this example we are using the function in a scriptfile named testService.ps1. All settings from 'testService.json' (if exist) and the testService object in 'globalSettings' will be added to the returning PSCustomObject.
PARAMETERS
-Filename
Name of file containing script specific settings.
1 2 3 4 5 6 7 8 9 |
|
-Path
Path to directory where settings files are located.
1 2 3 4 5 6 7 8 9 |
|
-ProgressAction
Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.
The ProgressAction parameter takes one of the ActionPreference enumeration values: SilentlyContinue, Stop, Continue, Inquire, Ignore, Suspend, or Break.
1 2 3 4 5 6 7 8 9 |
|
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.