With PowerShell 4.0 there are now cmdlets that give the file hash algorithms so I decided for my very first PowerShell script I would try and come up with a way to create a prefetch statement block for files.
Note: Since this is my first script, I’m not sure how accurate or useful this will be outside of my organization, but with the knowledgeable community we have here, I figured someone could probably find some use for it or even make it better! (You will need to tweak the URL portion to fit your environment)
Link to file: https://onedrive.live.com/redir?resid=3DD2FF7EE7C766A3!1728&authkey=!AJYPEo60SfsbFOc&ithint=file%2Cps1
Usage: When you run the script you should get an input box where you enter the full path to your file name (without quotes) and the script will output a file named “prefetch.txt” to the directory that you ran the script from.
Text File Output Example:
File Path: C:\Con_Worksheet.pdf
SHA1: 5ECA3E18ABC9EF67E00D1868B330D497482A6650
SHA256: 6017D552AF20FAD7311123887B6E06B73A47263E267FD515CA7F395AFD79F3C1
Size: 14233
######################################### Prefetch Statement Below ###############################################################*
begin prefetch block add prefetch item name=5ECA3E18ABC9EF67E00D1868B330D497482A6650 sha1=5ECA3E18ABC9EF67E00D1868B330D497482A6650 Size=14233 url=SWDProtocol://127.0.0.1:52311/Uploads/5ECA3E18ABC9EF67E00D1868B330D497482A6650/Con_Worksheet.pdf.bfswd
sha256=6017D552AF20FAD7311123887B6E06B73A47263E267FD515CA7F395AFD79F3C1
end prefetch block