If you’re wondering why your PDF files created using Microsoft Print to PDF driver aren’t indexed by Windows Search and not appearing in Search results, here is why it happens.
Update: This bug has been fixed in the newer Windows 10 versions.
Microsoft Print to PDF adds the FILE_ATTRIBUTE_TEMPORARY (“T”) attribute when outputting to PDF. As Raymond Chen [Microsoft] notes in his blog, if the “Temporary” attribute is set for a file, Windows Search doesn’t index it, and you can see that in the image below.
If you have a PDF writer software installed, open the PDF file that has the “T” attribute set, and save the file. This removes the “T” attribute.
Using BulkFileChanger to Remove Temporary Attribute
BulkFileChanger utility from NirSoft lets you set or unset Temporary attribute (or any other attribute) for the list of files you select.
Add the “Temporary” PDF files to the list box and select all. Click Actions, Change Time / Attributes (F6), set Temporary attribute to Turn Off, and click Do it.
Using PowerShell
This PowerShell command-line, posted by Directory Services Team Blog, removes the TEMPORARY Attribute for ALL file(s) in a folder, D:\Data in this example:
Get-childitem D:Data | ForEach-Object -process {if (($_.attributes -band 0x100) -eq 0x100) {$_.attributes = ($_.attributes -band 0xFEFF)}}
… and Search lists it now.
Check if the “T” Attribute is set for a file
Right-click on the file, click Properties. Click the Details tab to check the Attributes.
Using Command-line:
The Attrib command doesn’t tell if Temporary attribute has been set for a file; you need to use FSUtil to find it out.
fsutil usn readdata <filename>
File Attributes value 0x120 means ARCHIVE and TEMPORARY attributes are set. Here are the possible (bitmask) values: (from Directory Services – MS Team Blog)
- READONLY 0x1
- HIDDEN 0x2
- SYSTEM 0x4
- DIRECTORY 0x10
- ARCHIVE 0x20
- DEVICE 0x40
- NORMAL 0x80
- TEMPORARY 0x100
- SPARSE_FILE 0x200
- REPARSE_POINT 0x400
- COMPRESSED 0x800
- OFFLINE 0x1000
- NOT_CONTENT_INDEXED 0x2000
- ENCRYPTED 0x4000
After using BulkFileChanger or the PowerShell command to remove the “T” attribute, running FSUtil now shows this output:
Windows 10 Build was 10586.104 when this article was posted.