Add-printer: credential fail

Hi guys,

This is my first post in this forum so i hope i am following the rules correctly.

I am trying to set up a DOMAIN B printer on DOMAIN A computer, and it doesnt work.

Code:

Add-printer -connectionname \printer-server\printer

Error:

“add-printer alternate user credentials are required to access the specified resource”

I have found no way to add my DOMAIN B credentials to the script. Also, using a wscript.shell object, the printer is not found at all.

Relevant info:

The two domains have trust relationship whereas i can connect to the printer via SMB share and suitable DOMAIN B user credentials.

PS version: 5.1

Platform: win10, 1909

 

Any ideas?

Thanks in advance

If the domains are trusted, why not just give domainA user permissions to domainB printer? That is the purpose of domain trusts. Then you should be able to just run the command you have posted.

Hi Rob,

Thank you for your reply.

I have probably misused the term “Trust relationship”.Domain B is accessible from Domain A , but not vice versa. Users & Computers are valid only in their corresponding domain.

Do you have an idea of how to send the proper credentials to the printer?

That still sounds like DomainA (user domain) trusts DomainB (resource\printer domain). This still means that DomainA credentials can be given to DomainB resources.

If you do want to connect with credentials, then you would need to use WScript.Network or net use, both outlined here:

https://social.technet.microsoft.com/Forums/Lync/en-US/c001f594-d227-4b10-becd-b3b6b1605378/using-powershell-to-connect-network-printer-with-credentials?forum=ITCG

What is the scope of this project? Are you implement for multiple hosts or just trying to find a solution for your local workstation on a one off basis?

If this is a one off, and the domains are not trusted, you can enter domain B in your stored creds. Then it should work.

If this is for multiple users in a multi domain environment, and domain b is there to provide printing solutions to domain a, I would suggest to do as Rob says and implement a trust.

My $.02