January 1, 2021 at 7:19 am #283552ParticipantTopics: 1Replies: 1Points: 14Rank: Member
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.
Add-printer -connectionname \\printer-server\printer
“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.
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
Thanks in advance
January 1, 2021 at 10:05 am #283558ParticipantTopics: 17Replies: 1951Points: 3,987Rank: Community Hero
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.
January 2, 2021 at 2:31 am #283657ParticipantTopics: 1Replies: 1Points: 14Rank: Member
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?
January 4, 2021 at 12:04 pm #284059ParticipantTopics: 17Replies: 1951Points: 3,987Rank: Community Hero
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:
January 4, 2021 at 5:33 pm #284125ParticipantTopics: 10Replies: 201Points: 987Rank: Major Contributor
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.
- You must be logged in to reply to this topic.