# getPrinterNames() not showing all printers

**URL:** <https://forum.inductiveautomation.com/t/getprinternames-not-showing-all-printers/95499>\
**Category:** Ignition\
**Tags:** ignition81, perspective, scripting\
**Created:** [September 3, 2024, 5:19pm UTC](https://forum.inductiveautomation.com/t/getprinternames-not-showing-all-printers/95499 "2024-09-03T17:19:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [September 3, 2024, 5:19pm UTC](https://forum.inductiveautomation.com/t/getprinternames-not-showing-all-printers/95499/1 "2024-09-03T17:19:25Z")

</div>

I've added a few printers to a gateway VM through various methods (directly through TCP/IP, network printer wizard, etc). When I call `system.print.getPrinterNames()` only the Microsoft XPS Document Writer and Microsoft Print to PDF printers show up. However, if I call `system.print.getDefaultPrinterName()` then I can get the default printer.

I can change the default printer in the VM and it changes for getDefaultPrinterName but the added printers never show up in getPrinterNames. I've tried restarting the print spooler service with no luck.

I'm sure I'm missing something obvious.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 3, 2024, 5:20pm UTC](https://forum.inductiveautomation.com/t/getprinternames-not-showing-all-printers/95499/2 "2024-09-03T17:20:38Z")

</div>

Where are you calling this from?

---

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [September 3, 2024, 5:25pm UTC](https://forum.inductiveautomation.com/t/getprinternames-not-showing-all-printers/95499/3 "2024-09-03T17:25:50Z")

</div>

I have it on a perspective that calls it from a script library so it should be running from the Gateway?

```python
def getPrinterNames():
	printers = system.print.getPrinterNames()
	return printers
	
def getDefaultPrinter():
	printer = system.print.getDefaultPrinterName()
	return printer

```

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 3, 2024, 5:27pm UTC](https://forum.inductiveautomation.com/t/getprinternames-not-showing-all-printers/95499/4 "2024-09-03T17:27:01Z")

</div>

If it runs on the gateway then it's running as whatever service user Ignition is running as, which I'm guessing has something or everything to do with your problem.

See [system.print.getDefaultPrinterName() returns null - #9 by michael.flagler](https://forum.inductiveautomation.com/t/system-print-getdefaultprintername-returns-null/83803/9) also

---

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [September 3, 2024, 5:29pm UTC](https://forum.inductiveautomation.com/t/getprinternames-not-showing-all-printers/95499/5 "2024-09-03T17:29:47Z")

</div>

I logged into the VM as the service account and added the printers from there. I am also setting the default printer from the service account. Why would getDefaultName show the default printer as I'm changing it and the full list of printers not show up in getPrinterNames?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 3, 2024, 5:30pm UTC](https://forum.inductiveautomation.com/t/getprinternames-not-showing-all-printers/95499/6 "2024-09-03T17:30:22Z")

</div>

No idea. Windows stuff 😕

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [September 3, 2024, 7:24pm UTC](https://forum.inductiveautomation.com/t/getprinternames-not-showing-all-printers/95499/7 "2024-09-03T19:24:07Z")

</div>

A running java instance does not always grab newly installed printers that were installed while the runtime is up on windows.

An Ignition gateway service restart will allow those printers to be seen.

---

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [September 3, 2024, 7:25pm UTC](https://forum.inductiveautomation.com/t/getprinternames-not-showing-all-printers/95499/8 "2024-09-03T19:25:16Z")

</div>

Thanks, I have an after-hours gateway restart scheduled. I'll update with the outcome.

---

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [September 4, 2024, 12:03pm UTC](https://forum.inductiveautomation.com/t/getprinternames-not-showing-all-printers/95499/9 "2024-09-04T12:03:56Z")

</div>

Restarting the gateway service did the trick. Now all added printers are showing by calling `system.print.getPrinterNames()`
