Evince application on Windows 2012R2 RDP not printing - redirect

I have an Windows 2012R2 server. I connect to that server using RDP. When I start Evince.exe (a pdf viewer program) everything works fine, except for printing to the redirected printer. If I print, I get the standard printer dialog and it shows my redirected printer. When I print a pdf document using the redirected printer, I can see the job appearing in the printer queue for just a second and then disappearing again. But no printing occurs.
If I print to the Microsoft XPS printer, a .xps file is created properly. If I print a notepad using the redirected printer, it works fine. So the problem is purely with the redirected printer and Evince.
What could be the cause of this issue? I have tried to reset the printer spooler already using this in een elevated command prompt :
net stop spooler
DEL /F /S /Q %systemroot%\System32\spool\PRINTERS\*
net start spooler
But it still does not print. The Windows event logs show no errors or warnings.
Anyone have an idea how to solve this issue? Could it be a permissions issue?

Thank you for your reply. In the meantime I found that this issue is only with my personal account or pc. All my users can print using Evince and they have no admin privileges like me. The weird thing is, the print queue gets emptied on the server, but my pc does not receive the print job in the queue somehow. This only happens for Evince print jobs and not for any other print jobs. I tried to reboot both the server and my personal pc. There are no weird log entries on the server nor on my pc.
I tried to redirect another printer (Microsoft print to PDF printer) and that works fine. So the problem is with my HP laser printer. But why only for Evince print jobs??? I really have no clue what is causing this. Maybe my printer driver is corrupt somehow. I can try to reinstall my printer on my PC, maybe that will do the trick. I will try later this week because currently I am too busy to make time for this.
BR, Emphyrio

Related

Task scheduler "Run whether user is logged on or not" issue to startup application

I have a .bat file that starts up a powershell script.
Within this powershell script, i startup PowerBI with a given database.
The powershell script waits till powerBI has been done starting up, and will then be exporting data to some datadump files.
Doing this manually works fine, and also when its on the task scheduler to run when user is logged on.
The moment i change this to "Run whether user is logged on or not" it doesnt work anymore.
The reason behind this, is that it seems that powershell is unable to start PowerBI and therefore there is no open data to query in the rest of the script.
So the positive side is it runs the bat and powershell just fine, only the powershell itself seems incapable to start powerBI.
Are there any solutions to this? should i for example use a different method to call the appliation to start?
currently the powershell snippit to start the app looks like this:
$PBIDesktop = "C:\Program Files\Microsoft Power BI Desktop\bin\PBIDesktop.exe"
$template = "C:\LiveData\Data.pbix"
$waitoPBD = 60
$app = START-PROCESS $PBIDesktop $template -PassThru
log_message "Waiting $($waitoPBD) seconds for PBI to launch"
Start-Sleep -s $waitoPBD
I faced similar issue. So, sharing my experience..
First of all, please verify couple of things.
Specify user account which will be used to invoke the job. Also, ensure that, the account have sufficient permission.
Don't forget to un-check the checkbox (as shown in screenshot) under Conditions Tab
Just found this one - sorry it took so long :D
But, i had this totally nervwrecking issue to.
Solution for me is to realize that the task scheduler is very deep part of the OS.
Thats why i have to grant access to the file, for the computername$ (system name) on the file or folder containing the file to run.
Rightclick on the file or folder -> Security. Select edit and add [Name of your computer]$ and give the read and execute permissions.
That's the only way I can make it run.
But i hope you found the solution in the meantime :)

Out-printer command causes endless page counting loop with Zebra GK420d printer

I'm trying to write a PowerShell script to send data directly to Zebra GK420d label printer. "Out-Printer" produces endless count of pages and data not being sent to the printer.
Commands:
"data" | Out-Printer "ZDesigner GK420d"
or
Get-Content C:\barcode.txt | Out-Printer "ZDesigner GK420d"
result in producing print job with endless page counting and nothing being printed.
What worked for me was to share Zebra in my network and setting it up as lpt1 port:
net use lpt1: \\host\Zebra
I was able to copy a *.txt file with ZPL contents and it was interpreted correctly by the printer:
copy barcode.txt lpt1
That would work well as a work-around solution, but I'm trying to run this script on a server without admin rights. So sharing a printer or setting lpt1 cannot be done.
I want to be able to send data directly to the printer using PowerShell script, just like it can be done with "Print preferences>Tools>Action>Send command" or in Zebra Setup Utilities > Open Communication With Printer.
Any suggestions will be appreciated.
Inside of the Link-OS SDK there is a .NET SDK. This contains an command line exe which could be used from your script.
http://techdocs.zebra.com/link-os/2-14/pc_net/
Go to the link for "Use the command line"
I added new printer with "Generic \ Text driver" and pointed it to the USB002 port with Zebra printer. I can now use Out-Printer command as intended. Thanks for the answers.

Powershell to change password not working

I have a long Powershell script that "builds" a PC for me, by adding everything I need to a Windows 7 (32 bit) PC. I have had this script for several years and it has worked fine. One of the first things I do is change the password. This line of code suddenly doesn't work in the script -
([adsi]"WinNT://ccm2756/Administrator").SetPassword("NewPassword")
I get "the following exception has occurred while retrieving member SetPassword. Network path not found."
Has worked just fine all this time. And on the same PCs. Haven't changed the script, haven't changed the PCs (I've burned the images back to saved based operating systems). Suddenly, I am getting this error? And yet, if I open a command line and type "Powershell" to get to a PS Command line and run that exact same command, it goes through without any errors.
What am I missing here?

Unable to print PDFs or office documents via Scheduled task

I have a scheduled task set to run on a machine overnight. This task will iterate through a folder printing all the files found therein. I can run the process without issue while logged in however it does not print when run via the scheduled task.
More Info:
The scheduled task executes a powershell script that performs multiple functions such as generating and emailing reports, copying files across network folders and finally printing the contents of a folder. All of these tasks are performed without error if the executing account is currently logged in. If the account is not logged in and run via a scheduled task everything except the printing of Office and PDF documents works correctly (Text documents print fine).
Here is the function I am using to print the documents.
Function Print-File($file)
{
begin
{
function internal-printfile($thefile)
{
if ($thefile -is [string])
{
$filename = $thefile
}
else
{
if ($thefile.FullName -is [string] )
{
$filename = $thefile.FullName
}
}
$start = new-object System.Diagnostics.ProcessStartInfo $filename
$start.Verb = "print"
[System.Diagnostics.Process]::Start($start)
}
if ($file -ne $null)
{
$filespecified = $true;
internal-printfile $file
}
}
process
{
if (!$filespecified)
{
$test = write-Host process ; internal-printfile $_
}
}
}
When running from a scheduled task I can see the process start (Winword or AcroRd32) as I am dumping output to a text file however I do not see anything print. One other difference I noticed is that when I use this function while logged in the Applications other than Adobe reader (Office Apps) start to print the document then close. However when run from a scheduled task the applications do not close on their own.
I would appreciate any feedback, suggestions or pointers at this time as I have hit a wall as far as knowing what else I can check. I would also take suggestions as to an alternative way to accomplish the printing of the files. (NOTE: I cannot predict the file type in the folder)
NOTE: These symptoms are present on two machines, Windows server 2008 and Windows 7, both running Office 2007 and Adobe Reader 10.1.7
I'm trying to do the same thing that you are attempting. I'm pretty sure what you're running into is session 0 isolation. You can read more about it at this MSDN site and this Windows blog post.
I haven't tried the suggestions in the following answer to another question on SO, but it might be worth a try.
Creating Desktop-Folders for session 0
Here is another guy who is trying to print without having a user logged into the machine. There is an answer from someone who claims to know how to do what we're all trying to do, but he doesn't actually post the answer.
Too late for OP, but for future readers... I had the same problem, but with a windows shell .bat file, not PowerShell. As a scheduled task, the script would launch AcroRd32.exe /t, but it wouldn't print anything. Then after a delay, Acrobat was stopped, and the file was moved to the "Printed" folder like everything was good. It printed fine standalone, just not as a scheduled task.
(Background: I'm running Windows 10 x86 on one older computer so that we can use our two bulletproof HP LaserJet 1000 printers. However, the program we used for this in Win 7, batchdocprint, is incompatible with Win 10 and the company is gone. Due to having to learn arcane syntax and workarounds, I've spent way more money in hours getting a few lines of code (below) working right than the program cost, but I couldn't find a suitable replacement. The programs that I found either printed incorrectly, or had options for only one printer.)
The problem for me did seem to be Session 0 isolation blocking GDI+. I went with the seemingly "spammy" suggestion of getting Foxit Reader. It worked, and like Acrobat, the reader is free. I just replaced the path to AcroRd32.exe with the path to FoxitReader.exe
I don't think this will ever be possible with Acrobat Reader. The CLI is not officially supported, so the likelihood of Adobe ever changing it to print without launching the GUI is minimal.
As far as other file types, it depends on what you're using to print them, and whether it can open and print without a GUI. I haven't decided whether to implement this for other common file types so that we can just drag-and-drop, or to keep forcing the users to use the Acrobat PDF printers that are set up to save PDFs in the hot folders. Right now, it's the latter.
My code, for reference, to hopefully save someone else my headache. I only changed/shortened names, and removed duplicate code for the second folder/printer. Note that taskkill requires administrative privileges. Also, you probably need to have a folder named "Printed" in your hot folder, since I don't check for its existence:
#ECHO OFF
REM Monitors folders for PDF's and prints.
REM Use PING for delay - no built-in sleep functionality.
REM Using START backgrounds the process so the script can move on.
:LOOP
cd C:\Hot Folder\
for %%a in ("*.pdf") do (
start "" "C:\Path\To\FoxitReader.exe" /t "C:\Hot Folder\%%a" "HP 1000"
ping 1.1.1.1 -n 2 -w 5000 >NUL
taskkill /IM FoxitReader.exe /F
move /Y "%%a" ".\Printed\%%a")
ping 1.1.1.1 -n 2 -w 5000 >NUL
goto LOOP
Not sure if you ever found the solution to this, but it happens that the printer to be used by task scheduler job should be registered under:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers (local printers)
vs
HKEY_Current_User\Printers\Connections (session printers)

Messages Using Command prompt in Windows 7

How to send message over network using command prompt in windows 7 ?
"net send" is a command using a background service called "messenger".
This service has been removed from Windows 7. ie You cannot use 'net send' on Vista nor Win7 / Win8.
Pity though , I loved using it.
There is alternatives, but that requires you to download and install software on each pc you want to use, this software runs as background services, and i would advise one to be very very very very careful of using these kind of software as they can potentially cause seriously damage one's system or impair the systems securities.
winsent innocenti /
winsent messenger
****This command is risky because of what is stated above***
Type "msg /?" in the command prompt to get various ways of sending meessages to a user.
Type "net send /?" in the command prompt to get another variation of sending messages across.
You can use the net send command to send a message over a network.
example:
net send * How Are You
you can use the above statement to send a message to all members of your domain.But if you want to send a message to a single user named Mike, you can use net send mike hello!
this will send hello! to the user named Mike.
Open Notepad and write this
#echo off
:A
Cls
echo MESSENGER
set /p n=User:
set /p m=Message:
net send %n% %m%
Pause
Goto A
and then save as "Messenger.bat" and close the Notepad
Step 1:
when you open that saved notepad file it will open as a file Messenger command prompt
with this details.
Messenger
User:
after "User" write the ip of the computer you want to contact and then press enter.