Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Export-OfficeToml

Module
PSWriteOffice
Inputs
System.Object
Outputs
System.IO.FileInfo

Writes PowerShell objects to a TOML file; the file form of ConvertTo-OfficeToml.

Syntax

Export-OfficeToml
[-Depth <Int32>]
-InputObject <Object>
[-NoClobber]
[-PassThru]
[-Path] <String>
[-RootName <String>]
[<CommonParameters>]
#
Parameter set: InputObject

Description

The file is UTF-8 without a byte-order mark and is written atomically. An existing file is replaced unless NoClobber is set. Nested objects become [table] sections and lists of objects [[array]] sections; nulls are omitted with a warning.

Examples

Save settings to a file.

[ordered]@{ title = 'Report'; owner = [ordered]@{ name = 'Ops'; updated = Get-Date } } | Export-OfficeToml -Path ./settings.toml

Export an inventory without replacing an existing file.

Import-OfficeCsv -Path ./servers.csv | Export-OfficeToml -Path ./inventory.toml -RootName server -NoClobber -PassThru

Parameters

-Depth Int32 optional
How many levels of nested objects to write; deeper values become their string form.
-InputObject Object requiredpipeline: True (ByValue)
Objects to write; an argument is written exactly as given, piped objects as one value or an array.
-NoClobber SwitchParameter optional
Refuse to replace an existing file.
-PassThru SwitchParameter optional
Return the written file.
-Path String requiredposition: 0
The TOML file to create.
-RootName String optional
The key that holds input which is not an object, because a TOML document is a table.

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.