Hi @adam I am writing a dashboard for WooCommerce, when an order comes in i need to print to a POS printer. This is installed as a printer on the dashboard server (printer1). What i want to do is advanced printing and make use of ComObject Word.Application so i can modify the settings, and print to specific printers but i cant get it to work. This works fine from pwsh on the PSU node, logged in as the same account as the dashboard service runs from (domain\administrator). Word is also installed and activated against the same user on the same node…
It doesnt error at all, no logs but it fails straight away on ‘New-Object -ComObject Word.Application’
I have added toasts to see the output, and there is nothing after New-Object. I have also tried this from Start-Process with credentials but again nothing happens.
No errors at all, and you see some toasts in there, the first one fires, the second does not, so it appears to have trouble creating the Word.Application ComObject.
Oh now i get a error, i wasnt getting any yesterday…
[06-07-21 04:56:05 PM] An error occurred: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070520 A specified logon session does not exist. It may already have been terminated. (0x80070520).
Endpoint: d66678bd-13a3-4398-be68-ba03caec171b
Session: 47c573a0-b03a-4112-bc1a-f4cd32738b56
File: C:\ProgramData\UniversalAutomation\Repository\Data\Pages\Staging\TestCode.ps1
Endpoint Start Line: 37
Endpoint End Line: 54
Stack Trace: at , : line 4
That setting was already correct and it doesnt work… To be fair, i have done a lot of testing with this today and it just wont work… comobject for word wont work through invoke-command, enter-pssession.
have tried using : $PrintDocument = New-Object System.Drawing.Printing.PrintDocument
but I have got frustrated with it and given up for good old: Start-Process $Path -Verb PrintTo('Printer1')
The formatting is horrible on the ticket, and some serious messing with settings it kinda works, but not ideal… If anyone knows how to get either PrintDocument or Word.Application working then please reply!