How to Break links in PowerPoint with PowerShell

Hi all,

I want to break the links of all the existing linked objects in a Presentation using the following code

foreach ($Slide in $Presentation.Slides)
{
foreach ($Shape in $Slide.Shapes)
{
$Shape.LinkFormat.BreakLink()
}
}

An error appears… “This operation
requires a linked object”. I would like to know how I could ask if an Object is a Linked Object before the execution of the function BreakLinks()…

foreach ($Slide in $Presentation.Slides)
{
foreach ($Shape in $Slide.Shapes)
{
--------->>> if($Shape “is a Linked Object”) {
$Shape.LinkFormat.BreakLink() }
}
}

Thanks!!!