I am trying to create a shortcut on the desktop for print test page.
I have tried a couple of different googled solutions and cannot find one that works...
First I tried -
cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnqctl.vbs -e -p "Brother PJ-622"
I tried this from both a normal and elevated command prompt - logged in user is a local admin - both resulted in
Failed Print Test Page Win32 error code 5
I tried the same command using a -u and -w command to specify the local admin account. This didnt work either and
I also tried
print /d:printer textpage.txt
just to get something to print... this didnt work..
Ok I had all this typed out and found a powershell solution that works so I am going to go ahead and post this anyways for anyone else to use. There was alot of ways with powershell 4 using invoke but i found a simpler way with a couple lines to print to default printer. This works on powershell version 2.
Create PrintTestPage.ps1 in notepad and save as ps1 file...
$printer = Get-WmiObject -Query " SELECT * FROM Win32_Printer WHERE Default=$true"
$PrintTestPage = $printer.PrintTestPage()
Edit - obviously for the shortcut I just modified the target to the path of the script.
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\MDT\Powershell\PrintTestPage.ps1