I'm using the code below to edit the image in a webpart:
$webPartCollection = $web.GetWebPartCollection("default.aspx","Shared")
$imagePart = $webPartCollection | Where-Object { $_.Title -eq "Site Image"}
$imagePart.ImageLink = "web/PublishingImages/myPicture.jpg"
$webPartCollection.SaveChanges($imagePart.StorageKey)
But I'm unable to save the webpart, I get the following error:
Exception calling "SaveChanges" with "1" argument(s): "Could not find file 'C:\ Users\admin\AppData\Local\Temp\2\yqvs9p_s.dll'." At line:1 char:31
+ $webPartCollection.SaveChanges <<<< ($imagePart.StorageKey)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
What am I doing wrong?
Why is it looking for that (random) dll?