Skip to content

Get ConfigurationData

Mateusz Czerniawski edited this page Aug 29, 2018 · 4 revisions

Get-ConfigurationData

PPoShTools -> Get-ConfigurationData.ps1

Synopsis

Get-ConfigurationData will retrieve configuratin depending on the input

Syntax

Get-ConfigurationData [-ConfigurationPath] <String[]> [[-OutputType] <String>] 
[<CommonParameters>]

Description

Currently JSON (.json) and PowerShell Data (.psd1) are supported. For JSON files possible output is Hashtable (default) and PSObject. For PSD1 files only Hashtable is currently supported. Using helpers function will return an object data from given configuration file

Parameters

-ConfigurationPath<String[]>

Path to JSON or psd1 file

  • PipelineInput: false
  • Required: true

-OutputType<String> (default: HashTable)

  • Valid values: PSObject, HashTable
  • DefaultValue: HashTable
  • PipelineInput: false
  • Required: false

Examples

Example 1

Get-ConfigurationData -ConfigurationPath C:\SomePath\Config.json -OutputType Hashtable

Will read content of Config.json file and convert it to a HashTable.

Example 2

Get-ConfigurationData -ConfigurationPath C:\SomePath\Config.json -OutputType PSObject

Will read content of Config.json file and convert it to a PS Object.

Example 3

Get-ConfigurationData -ConfigurationPath C:\SomePath\Config.psd1

Will read content of Config.psd1 file and return it as a HashTable.