Peter Langford gave this method:
Not automated tho.
Also prompt was for keeping the UPN as the file name - adjust if you want to use a different identifier.
Native Bromcom you cannot, but you can do it another way, but the image quality will be lower.
Create a Quick Report on Students domain. Include just the group UPN and Photo.
Important SORT IT by UPN or Group but you will need an order you can recreate later on.
Save the report
Now export as EXCEL file from within report writer.
Open Excel, remove the other data from the file i.e. the UPN and Group you do not need it, but leave the images.
Save this file.
Save it again, and here is the magic part ... Save As HTML file.
This will create a subdirectory or all the images in the html file, labelled image001.png etc.
Now create a new EXCEL file.
This excel will rename the orginal name to new UPN, remember the sort order from earlier? Well use that here as the images extracted are in order of that sort order. Will leave you to work that part out, but then you end up finally with three columns in Excel
Original image name: New name : Command
Image001.PNG A123456UPN.PNG: Ren image001.png A123456UPN.PNG
Open command prompt, change to the directory you have images stored then copy the last column from Excel into it.
Sorted.