Test-OfficeDocument
Validates native document structure, schema, security, accessibility or compliance without changing the input.
Syntax
Test-OfficeDocument
[-Check <Structure| Schema| Security| Accessibility| Compliance>]
[-Options <Object[]>]
[-Password <SecureString>]
[-Path] <String[]>
[-Quiet]
[-Untrusted]
[<CommonParameters>]#PathTest-OfficeDocument
[-Check <Structure| Schema| Security| Accessibility| Compliance>]
-LiteralPath <String[]>
[-Options <Object[]>]
[-Password <SecureString>]
[-Quiet]
[-Untrusted]
[<CommonParameters>]#LiteralPathTest-OfficeDocument
[-Check <Structure| Schema| Security| Accessibility| Compliance>]
[-Document] <Object>
[-Options <Object[]>]
[-Quiet]
[-Untrusted]
[<CommonParameters>]#DocumentDescription
Unsupported checks are reported as not applicable. NativeReports retains native security, capability and PDF proof evidence. Options accepts typed check settings or hashtables; later values replace the matching settings group.
Examples
Validate workbook structure
Test-OfficeDocument -Path .\Reports\Sales.xlsxReturns the common report and the native workbook doctor findings.
Check untrusted packages
Test-OfficeDocument -LiteralPath .\Uploads\Proposal.docx -Check Security -Untrusted -QuietReturns a Boolean after applying the untrusted package policy.
Parameters
- -Check OfficeDocumentCheck[]
- Checks to perform. Defaults to Structure.
- Possible values:
Structure,Schema,Security,Accessibility,Compliance - -Options Object[]
- Native check-specific options or flat hashtables, routed to the selected format through the shared binder. For PDF compliance checks, a flat Profile means the compliance profile; use typed PdfLoadOptions for a separate read profile.
- -Password SecureString
- Password for a path input. Accepts SecureString or PSCredential; plain strings are transformed with a warning.
- -Path String[]
- Filesystem paths with wildcard expansion.
- -Quiet SwitchParameter
- Returns IsValid as a Boolean instead of the report.
- -Untrusted SwitchParameter
- Also applies the existing untrusted package-security policy.
- -LiteralPath String[]
- Literal filesystem paths; binds FileInfo.FullName and provider PSPath.
- -Document Object
- Caller-owned live native model, including unsaved edits.
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.