Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Get-OfficePackageSecurity

Module
PSWriteOffice
Inputs
System.String
Outputs
OfficeIMO.OfficePackageSecurityReport

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

Syntax

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

Examples

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

$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.

Parameters

-Options OfficePackageSecurityOptions optional
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 optional
Throw on the first policy violation instead of returning only the report.
-Untrusted SwitchParameter optional
Use the bounded policy that rejects macros, embedded payloads, ActiveX, and external relationships.

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.