Printing New Files In Directory

Learned a few things - Powershell 2.0 wasn’t working at all really. I could only do 1 folder at a time. I upgraded to 4.0 and now it works with all the folders under the parent.

I’ve edited this one line and I believe its working. There are so many files, my guess is this script is checking each file in every folder. So in my mind if there were less files to analyze things might work a little better. Is this the correct way to do this?

Get-ChildItem -Path $Path -Recurse -exclude *-DAY.HTM, *.PDF , *MAINTENANCE*.HTM 

Only thing left to do is get rid of this annoying “would you like to print” dialogue

Yes, your usage of -exclude looks correct, although you should not need to exclude *.PDF since your -Path should specify *.htm, so there are no PDFs to exclude.

As far as the dialog, ya it’s a problem. I spend some time searching and testing and did not come up with a solid solution for rendering and then print the HTM without being prompted by the dialog. The “RUNDLL32.EXE MSHTML.DLL,PrintHTML $file $printer” method would not work for me, nor would the automation using IE com object.

I actually just ran across this free utility, but I have not tried it. Maybe it will actually do what you need.
(I have no affiliations with this site or utility so use at your own risk)
http://www.printhtml.com/

Yeah, I have looked everywhere myself for a solution. Don’t laugh… but I have 1 that might work… really dirty. I’m going to try and use autohotkey and send a spacebar press over and over during the time the powershell script is running. This should press the print button in the print dialogue box. Fortunately, the Print button is in focus when the box appears. I’ll let you know how it works out!