Under one of our company's subsites, we have /SitePages/{employee-name}.aspx which is a normal SharePoint page with the employee's information in text plus their picture.
I'm looking for a way to loop through all SitePages and retrieve ONLY the image and save it locally with PowerShell. I've tried a number of cmdlets from the PnP PowerShell such as Get-PnPWikiPageContent, to no avail. Is it even possible to obtain specific elements of an aspx SharePoint page such as images?
Here's an example of what I tried:

Get-PnPWikiPageContent -ServerRelativePageUrl "/SitePages/{employee-name}.aspx"

If anyone could tell me how to do it from even a single page (without looping through them all) I'd be more than happy.

1 Answer 1


As far as I know, there is no PowerShell cmdlet to get images from site pages.

The images on site pages are stored in the picture libraries, Site Assets library, personal OneDrive folder or external website (Stock), depending on how they are inserted on the page. If the employee pictures are all uploaded from local drives, you should be able to find them in the folder SiteAssets/SitePages/<pagename> and download them easily.

Or you can use other methods like REST API to get contents from the site page (or the folder as mentioned). Sample reference: Download and upload file from share point using Java (Rest API call).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.