set-printer: the application called an interface that was marshalled

On various powershell set-printer commands, I receive the error “set-printer : The application called an interface that was marshalled for a different thread”. These commands used to work, but we recently upgraded to powershell 5.1. The set-printer command appears to work even after giving the error message. Has anyone seen this before or have ideas on how to fix it?

Thank you,
Jim

This is not a PoSH specific thing. You will see this from other sources as well.

The application called an interface that was marshalled for a different thread. The error occurs once in a while when printing out from a Windows application. https://blogs.msdn.microsoft.com/larryosterman/2005/08/25/the-application-called-an-interface-that-was-marshalled-for-a-different-thread

Thanks for the info. After looking at other servers, we are thinking it may be related to .net. I will pass this along to our server team.