Cmdlet
Import-OfficeYaml
Reads YAML files as PowerShell objects; the file form of ConvertFrom-OfficeYaml.
Syntax
Import-OfficeYaml
[-AllDocuments]
[-AsHashtable]
[-Depth <Int32>]
[-NoEnumerate]
[-Path] <String[]>
[-Schema <Failsafe| Json| Core| Yaml11>]
[-Strict]
[-Untrusted]
[<CommonParameters>]#Parameter set:
PathImport-OfficeYaml
[-AllDocuments]
[-AsHashtable]
[-Depth <Int32>]
-LiteralPath <String[]>
[-NoEnumerate]
[-Schema <Failsafe| Json| Core| Yaml11>]
[-Strict]
[-Untrusted]
[<CommonParameters>]#Parameter set:
LiteralPathDescription
The encoding (UTF-8, UTF-16 or UTF-32) is detected from the file. Output follows ConvertFrom-OfficeYaml: mappings become PSCustomObjects in file order, or ordered hashtables with AsHashtable. A file that fails to parse writes a non-terminating error with the engine's code, line and column, and the next file is read.
Examples
Read a settings file.
$settings = Import-OfficeYaml -Path ./settings.yaml
$settings.logging.levelList the kinds in every manifest under a folder.
Get-ChildItem ./deploy -Filter *.yaml | Import-OfficeYaml -AllDocuments | Group-Object kindParameters
- -AllDocuments SwitchParameter
- Read every document of a multi-document file; without it, more than one document is an error.
- -AsHashtable SwitchParameter
- Return mappings as ordered hashtables instead of PSCustomObjects.
- -Depth Int32
- Deepest nesting of mappings and sequences to accept; sets the reader's MaxDepth.
- -NoEnumerate SwitchParameter
- Write a root sequence as one array instead of enumerating its items.
- -Path String[]
- YAML files with FileSystem wildcard expansion.
- -Schema YamlSchema
- Schema for scalar types: Core (the default), Json, Yaml11, or Failsafe to keep every scalar a string.
- Possible values:
Failsafe,Json,Core,Yaml11 - -Strict SwitchParameter
- Applies the YAML specification's exact rules instead of accepting common real-world leniencies.
- -Untrusted SwitchParameter
- Caps every limit at the engine's untrusted defaults, for files from outside.
- -LiteralPath String[]
- Literal YAML files, including FileInfo.FullName and provider PSPath.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.