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

Remove-OfficePowerPointSlide

Module
PSWriteOffice
Inputs
None

Removes a slide by index.

Syntax

Remove-OfficePowerPointSlide
-Index <Int32>
[-PassThru]
-Presentation <PowerPointPresentation>
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Supports -WhatIf/-Confirm thanks to SupportsShouldProcess.

Examples

Delete the first slide.

$ppt = New-OfficePowerPoint -Path .\Examples\Documents\PowerPointRemoveSlide.pptx -NoSave
Add-OfficePowerPointSlide -Presentation $ppt -Layout 1
Add-OfficePowerPointSlide -Presentation $ppt -Layout 1
Remove-OfficePowerPointSlide -Presentation $ppt -Index 0 -Confirm:$false
Close-OfficePowerPoint -Presentation $ppt -Save

Removes the first slide and saves the updated deck.

Parameters

-Index Int32 required
Zero-based slide index.
-PassThru SwitchParameter optional
Emit the object created or changed by the command.
-Presentation PowerPointPresentation required
Presentation to modify.

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.