Project

PSWriteOffice

PowerShell document automation across Word, Excel, PowerPoint, PDF, Reader, Confluence, Visio, and open text formats.

Stars 161
Forks 15
PowerShell Gallery downloads 158,661
Release v3.0.7
Language: C# Updated: 2026-09-19

API Reference

Cmdlet

Get-OfficePackageSecurity

Namespace PSWriteOffice
Inputs
System.String
Outputs
OfficeIMO.OfficePackageSecurityReport

Inspects an Open XML or compound Office package without opening active content.

Remarks

Inspects an Open XML or compound Office package without opening active content.

Examples

Authored help example

Inventory active content and reject it under an untrusted-input policy.

PS>


$report = Get-OfficePackageSecurity -Path .\Incoming\Report.xlsm -Untrusted
            $report | Select-Object IsValid, MacroPartCount, EmbeddedPayloadPartCount, ExternalRelationshipCount
            $report.Findings | Format-Table Severity, Rule, PartName, Message
        

Returns observations and policy violations; it does not execute package content.

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.

Syntax

Get-OfficePackageSecurity [-Options <OfficePackageSecurityOptions>] -Path <String> [-ThrowOnViolation] [-Untrusted] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

Options OfficePackageSecurityOptions optionalposition: namedpipeline: False
Custom package size, expansion, and active-content policy.
Path String requiredposition: 0pipeline: True (ByValue)aliases: FilePath
Path to an Open XML or compound Office package.
ThrowOnViolation SwitchParameter optionalposition: namedpipeline: False
Throw on the first policy violation instead of returning only the report.
Untrusted SwitchParameter optionalposition: namedpipeline: False
Use the bounded policy that rejects macros, embedded payloads, ActiveX, and external relationships.

Outputs

OfficeIMO.OfficePackageSecurityReport