New-OfficeHiddenDataOptions
Chooses which hidden data Remove-OfficeHiddenData and Optimize-OfficePdf -Sanitize remove.
Syntax
Description
With no parameters the options select the Default categories: document and custom properties, comments, personal identities, speaker notes, the thumbnail, custom XML, image metadata, printer settings, external references, document variables, revision identifiers and active content such as scripts. Tracked changes, hidden content, provenance, attachments and bookmarks change what readers see or what the file discloses, so they are removed only when you name them.
Examples
Also remove Content Credentials and AI labels, and accept tracked changes.
$options = New-OfficeHiddenDataOptions -Kind Default, Provenance -TrackedChanges AcceptAll
Remove-OfficeHiddenData -Path .\Proposal.docx -Options $optionsRemove AI-generated labels from a poster but keep its Content Credentials.
$options = New-OfficeHiddenDataOptions -Kind Default, Provenance -KeepProvenance C2pa, External
Remove-OfficeHiddenData -Path .\Poster.pdf -Options $optionsClean everything, including hidden sheets and attachments.
Remove-OfficeHiddenData -Path .\Budget.xlsx -Options (New-OfficeHiddenDataOptions -Kind All)Parameters
- Name that replaces authors on comments and revisions that stay in the file. Defaults to Author.
- -KeepProvenance String[]
- Provenance carriers to keep when Provenance is selected: C2pa (Content Credentials), External (links to Content Credentials) or AiSource (AI-generated labels).
- Possible values:
C2pa,External,AiSource - -Kind OfficeHiddenDataKind[]
- Categories to remove, combined. Defaults to Default; All selects every category.
- Possible values:
DocumentProperties,CustomProperties,Comments,TrackedChanges,PersonalIdentities,HiddenContent,SpeakerNotes,Thumbnail,CustomXml,ImageMetadata,PrinterSettings,ExternalReferences,DocumentVariables,RevisionIdentifiers,Provenance,Attachments,ActiveContent,Default,Bookmarks,All - -TrackedChanges OfficeTrackedChangesAction
- Keep, accept or reject tracked changes. Defaults to Keep, which reports them and leaves them in place.
- Possible values:
Keep,AcceptAll,RejectAll
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.