# Print Test Page on a specific printer

**URL:** <https://forums.powershell.org/t/print-test-page-on-a-specific-printer/9800>\
**Category:** PowerShell Help\
**Created:** [December 4, 2017, 5:09am UTC](https://forums.powershell.org/t/print-test-page-on-a-specific-printer/9800 "2017-12-04T05:09:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kate-ritter](https://avatars.discourse-cdn.com/v4/letter/k/e9bcb4/32.png) [@kate-ritter](https://forums.powershell.org/u/kate-ritter)\
**Post date:** [December 4, 2017, 5:09am UTC](https://forums.powershell.org/t/print-test-page-on-a-specific-printer/9800/1 "2017-12-04T05:09:12Z")

</div>

Hello,

I would like to be able to print a testpage on a given system.

So far I have this one-liner:

(Get-WmiObject win32\_printer -ComputerName | where {$\_.name -eq “”}).printTestPage()

this doesn’t create an error and I can see in the printer queue that something comes in, is being spooled and then leaves the queue.

The only problem is, that nothing is coming out of the printer. I’m ruling out a printer issue since printing the test page via the GUI works fine.

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![sanchez](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@sanchez](https://forums.powershell.org/u/sanchez)\
**Post date:** [December 4, 2017, 6:31am UTC](https://forums.powershell.org/t/print-test-page-on-a-specific-printer/9800/2 "2017-12-04T06:31:11Z")

</div>

> **[Use PowerShell to Send Test Page to a Printer](https://devblogs.microsoft.com/scripting/use-powershell-to-send-test-page-to-a-printer/)**
>
> Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to send a test page to a printer. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sipping an awesome orange-cream tea that I picked up at a tea shop in...

---

<div class="post-metadata">

**Author:** ![kate-ritter](https://avatars.discourse-cdn.com/v4/letter/k/e9bcb4/32.png) [@kate-ritter](https://forums.powershell.org/u/kate-ritter)\
**Post date:** [December 6, 2017, 5:18am UTC](https://forums.powershell.org/t/print-test-page-on-a-specific-printer/9800/3 "2017-12-06T05:18:41Z")

</div>

Hello,

thank you for the link.

Unfortunately I can only work with PowerShell 2 on this machine…

Therefore CIM is not an option.

I still dont understand why my WMI command doesn’t work. Since it is spooling, but physically nothing comes out of the printer ☹

Thank you

---

<div class="post-metadata">

**Author:** ![skalizar](https://avatars.discourse-cdn.com/v4/letter/s/ecc23a/32.png) [@skalizar](https://forums.powershell.org/u/skalizar)\
**Post date:** [December 6, 2017, 8:35am UTC](https://forums.powershell.org/t/print-test-page-on-a-specific-printer/9800/4 "2017-12-06T08:35:22Z")

</div>

The method you used worked for me, however, there were some differences in execution. I collected local printers into an array, then called the method on the one I wanted to test, which was a virtual printer (Print to One Note).

```
$p= Get-WmiObject win32_printer
$p[0].printtestpage()
```

So, in theory at least, your method should work. Try breaking it down into smaller steps and confirm each one.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:37pm UTC](https://forums.powershell.org/t/print-test-page-on-a-specific-printer/9800/5 "2024-05-16T20:37:05Z")

</div>

Closed on May 16, 2024, 8:37pm UTC


