Cmdlet
Export-OfficeYaml
Writes PowerShell objects to a YAML file; the file form of ConvertTo-OfficeYaml.
Syntax
Export-OfficeYaml
[-Depth <Int32>]
-InputObject <Object>
[-NoClobber]
[-PassThru]
[-Path] <String>
[-WriteOptions <YamlWriterOptions>]
[<CommonParameters>]#Parameter set:
InputObjectDescription
The file is UTF-8 without a byte-order mark and is written atomically. An existing file is replaced unless NoClobber is set. To change values in an existing file while keeping its comments and layout, use Open-OfficeYaml and Set-OfficeYamlNode instead.
Examples
Save settings to a file.
[ordered]@{ logging = [ordered]@{ level = 'Information' }; retries = 3 } | Export-OfficeYaml -Path ./settings.yamlExport an inventory without replacing an existing file.
Import-OfficeCsv -Path ./servers.csv | Export-OfficeYaml -Path ./inventory.yaml -NoClobber -PassThruParameters
- -Depth Int32
- How many levels of nested objects to write; deeper values become their string form.
- -InputObject Object
- Objects to write; an argument is written exactly as given, piped objects as one value or a sequence.
- -NoClobber SwitchParameter
- Refuse to replace an existing file.
- -PassThru SwitchParameter
- Return the written file.
- -Path String
- The YAML file to create.
- -WriteOptions YamlWriterOptions
- Indentation and line-break settings, as a YamlWriterOptions object or hashtable.
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.