Add-printer: credential fail

Welcome Forums General PowerShell Q&A Add-printer: credential fail

Viewing 4 reply threads
  • Author
    Posts
    • #283552
      Participant
      Topics: 1
      Replies: 1
      Points: 14
      Rank: Member

      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

    • #283558
      Participant
      Topics: 17
      Replies: 1951
      Points: 3,987
      Helping Hand
      Rank: 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.

    • #283657
      Participant
      Topics: 1
      Replies: 1
      Points: 14
      Rank: Member

      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?

    • #284059
      Participant
      Topics: 17
      Replies: 1951
      Points: 3,987
      Helping Hand
      Rank: 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:

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

    • #284125
      Participant
      Topics: 10
      Replies: 201
      Points: 987
      Helping Hand
      Rank: 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.

      My $.02

Viewing 4 reply threads
  • You must be logged in to reply to this topic.