2 people found this helpful
Figured out what the issue was. The variable %HOMEPATH% was not the variable I should have used. As a workaround I have placed the script on end users desktop via File and Folder UEM section and used command "%userprofile%\Desktop\BizPrinters.bat" in a Logon Task to map the TCP/IP printers. Alternatively one could input the command to map printer in the Logon Task, but I am not sure the order of Logon Tasks so I opted to call the printer mapping script instead.
I have a quick update. Mapping a printer this way, will leave the printer and port on the VM if no corrective action is taken to remove them. In addition printer added this way will become the default printer for next end user of VM printer was mapped on. I am exploring another option mentioned in this forum linked below, but it does not seem to be working with directly mapped TCP/IP printers, plus it captures all UEM mapped printer, and user mapped printer . For peace of mind I would recommend you add printer needed to a print server, as UEM support print queues natively.
I would recommend a task to unmap any printer added using this method if the printer is not needed by all your end users. Below you will find a script to unmap printer and port created by example script to map printer. You can place the script(s) on the UEM share, instead of using the UEM File & Folders feature. You can then reference the script(s) by the logon/logoff task feature of UEM. I created a folder Scripts under the UEM share General folder, and placed both scripts in the folder created.
Unmap Printer Script
cscript "c:\Windows\System32\Printing_Admin_Scripts\en-US\Prnmngr.vbs" -d -p “BizPrinter”
cscript c:\Windows\System32\Printing_Admin_Scripts\en-US\prnport.vbs -d -r IP_10.216.40.191