Cmdlet
ConvertTo-OfficeDocument
Converts a file or file batch through the canonical OfficeIMO workflow runner.
Syntax
ConvertTo-OfficeDocument [-ConflictPolicy <Fail|Rename|Replace>] [-ConversionOptions <OfficeWorkflowConversionOptions>] [-ConversionRouteId <String>] [-InputPath] <Object[]> [-MaximumInputBytes <Int64>] [-MaximumOutputBytes <Int64>] [-OutputPath] <String> [-OutputProfile <Faithful|Lightweight|PrintReady|TextOnly>] [-Password <String>] [-SummaryVariable <String>] [<CommonParameters>]#Parameter set:
FileConvertTo-OfficeDocument [-CheckpointDirectory <String>] [-ConflictPolicy <Fail|Rename|Replace>] [-ConversionOptions <OfficeWorkflowConversionOptions>] [-ConversionRouteId <String>] [-InputPath] <Object[]> [-ItemResults] [-MaximumConcurrency <Int32>] [-MaximumFiles <Int32>] [-MaximumInputBytes <Int64>] [-MaximumOutputBytes <Int64>] -OutputDirectory <String> [-OutputProfile <Faithful|Lightweight|PrintReady|TextOnly>] [-Password <String>] [-RetryFailed] [-SummaryVariable <String>] -TargetExtension <String> [<CommonParameters>]#Parameter set:
FilesConvertTo-OfficeDocument [-CheckpointDirectory <String>] [-ConflictPolicy <Fail|Rename|Replace>] [-ConversionOptions <OfficeWorkflowConversionOptions>] [-ConversionRouteId <String>] -InputDirectory <String> [-ItemResults] [-MaximumConcurrency <Int32>] [-MaximumFiles <Int32>] [-MaximumInputBytes <Int64>] [-MaximumOutputBytes <Int64>] [-NoRecurse] -OutputDirectory <String> [-OutputProfile <Faithful|Lightweight|PrintReady|TextOnly>] [-Password <String>] [-RetryFailed] [-SourceExtension <String[]>] [-SummaryVariable <String>] -TargetExtension <String> [<CommonParameters>]#Parameter set:
DirectoryDescription
Requires PowerShell 7.4 or newer. Returns verified workflow evidence; unsupported input is diagnosed by the owning route.
Examples
Convert one supported input with output evidence.
ConvertTo-OfficeDocument -InputPath ./report.pdf -OutputPath ./report.docxConvert selected PDFs to editable Word documents.
Get-ChildItem ./reports -Filter *.pdf | ConvertTo-OfficeDocument -OutputDirectory ./word -TargetExtension docx -ItemResultsRun a resumable directory job with an explicit loss policy.
ConvertTo-OfficeDocument -InputDirectory ./source -OutputDirectory ./pdf -TargetExtension pdf -CheckpointDirectory ./state -ConversionOptions (New-OfficeConversionOptions -RequireNoLoss)Parameters
- -ConflictPolicy String
- Existing destination behavior. Checkpoint jobs require Fail.
- Possible values:
Fail,Rename,Replace - -ConversionOptions OfficeWorkflowConversionOptions
- Renderer and reconstruction settings from New-OfficeConversionOptions.
- -ConversionRouteId String
- Optional exact canonical route identifier from Get-OfficeConversionRoute.
- -InputPath Object[]
- Literal source paths or FileInfo objects. Strings, arrays and file pipelines share one bounded selection.
- -MaximumInputBytes Int64
- Maximum bytes read from one source.
- -MaximumOutputBytes Int64
- Maximum generated bytes per document.
- -OutputPath String
- Single-file destination; its extension selects the target format.
- -OutputProfile String
- Cross-format output intent, subject to the selected route's supported profiles.
- Possible values:
Faithful,Lightweight,PrintReady,TextOnly - -Password String
- Runtime-only password for encrypted Office or PDF source files.
- -SummaryVariable String
- Variable receiving the final batch summary or single-file result.
- -CheckpointDirectory String
- Separate durable state directory. Completed artifacts are verified and reused.
- -ItemResults SwitchParameter
- Stream per-file evidence instead of only the bounded batch summary.
- -MaximumConcurrency Int32
- Maximum concurrently running batch items.
- -MaximumFiles Int32
- Maximum selected or discovered files.
- -OutputDirectory String
- Destination directory for selected-file or directory batches.
- -RetryFailed SwitchParameter
- Retry recorded failures without replacing verified completed artifacts.
- -TargetExtension String
- Target extension for every batch item, with or without a leading dot.
- -InputDirectory String
- Literal source directory for a batch.
- -NoRecurse SwitchParameter
- Do not traverse child directories.
- -SourceExtension String[]
- Limit directory discovery to these source extensions.
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.