Problem: We need incoming faxes to print automatically at a specific printer, and provide a similar experience the the now retired physical fax machine
Solution: Use SRFax Xfer application on a virtual machine to download the faxes. And use a powershell script and scheduled task to automatically print the downloaded faxes to the printer
# Acquire a windows computer or vm
You'll need a Windows computer or virtual machine to run the automation. Running the srfax downloader takes very little system resources so using an existing machine should be fine.
# Set up a service account on the computer
We'll be using nssm to run srfax downloader as a service. In cases like this it's a good idea to create a dedicated local user on the computer which will be used to run the service.
For example: MyServer\srfax
# Set up the SRFax Xfer downloader application
Before making any changes, you'll want to login using the service account you just created, and perform the configuration under that user account.
The SRFax downloader application can be found here: https://www.srfax.com/more/utilities-tools/srfax-downloader/
The working folder structure was set up like this:
Application folder will be used for srfax downloader, nssm, and the powershell script.
Incoming folder will be used to store the incoming faxes.
After downloading the srfax downloader zip file, extract the contents into C:\srfax\application, so the application is now located in C:\srfax\application\SRFaxXfer.exe
Launch SRFaxXfer.exe and configure it (instructions for how to configure are bundled in the zip file). Make sure you set the master account folder to "C:\srfax\incoming" and save your settings.
By this point while the app is running you should be able to send yourself test faxes, and have them be downloaded into the incoming folder.
# Set up NSSM and run srfax as a service
SRFaxXfer.exe will only run if a user is logged in, which will not always be the case for a server OS or a VM. So if you're running it on windows server you might want to use NSSM to force it to run as a service.
Running as a service means it starts automatically without any user logged in, attempts to restart itself if it fails, and can be monitored more easily.
The reason is that the application can be opened using the srfax user account and configured with the GUI. When NSSM runs the app as a service, it's using the same configuration that was configured using the GUI.
Download nssm and place it in the application directory, for example:
running ".\nssm.exe install srfax" in command prompt will launch the nssm GUI and you can configure the service.
The service should run C:\srfax\application\SRFaxXfer.exe and log on using the service user you created earlier.
The service status can be viewed with Get-Service srfax
The service configuration can be viewed by running this command: C:\srfax\application\nssm-2.24\win64\nssm.exe edit srfax
At this point the srfax downloader application should be configured, and running as a service.
# Setting up the auto-print scheduled task
The other half of the solution is to print the faxes.
Create a scheduled task, which runs a powershell script like this one every 5 minutes (5 mins is the shortest amount of time a scheduled task will allow you to repeat).
# Grabs a fax from the incoming folder, sends it to the printer, and deletes the fax
$freshfax = Get-ChildItem -Path C:\srfax\incoming\*.tif | Select-Object -First 1
Out-Printer -Name "\\server\MyPrinter" -InputObject $freshfax
$freshfax | Remove-Item