M
M
mr jeery2017-07-10 20:31:38
System administration
mr jeery, 2017-07-10 20:31:38

How to remotely connect a printer to a user?

There is a company N. I'm in it in those. support on the 1st line. It has a bunch of domain computers, accounts (whose passwords I don’t know) and prints on the print server. My UZ with the rights of a regular administrator, not a domain one, but I can connect to the root drives of users.
Is there some way to console connect these malicious network printers, so as not to spend a LOT of time connecting to the user's desktop?
First tried with psexec and:
start /wait rundll32 printui.dll,PrintUIEntry /q /in /n"\\%printer%"
start /wait rundll32 printui.dll,PrintUIEntry /q /y /n"\\%printer%"
start /wait sc stop spooler
start /wait sc start spooler

But it doesn't work, you need to know the user's login password.
Are there any other options?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2017-07-11
@Adorne

It is worth asking domain admins to configure GPP to connect printers to users.

S
SystemShock, 2017-07-10
@SystemShock

I once had a similar issue. Used logon a script for connection - disconnection of printers. Rewrite for yourself.

spoiler
'VBScript
'on error resume next

Const ForReading = 1, ForWriting = 2, ForAppending = 8
MegaPrinter = 0

Set WSHNetwork = WScript.CreateObject("WScript.Network")
Set colPrinters = WSHNetwork.EnumPrinterConnections
Set fso = CreateObject("Scripting.FileSystemObject")

If colPrinters.Count > 0 then
  For i = 0 To colPrinters.Count - 1 Step 2
    if instr(colPrinters(i+1), "TNIKIT28") > 0 then
'			msgbox colPrinters(i) & chr(9) & colPrinters(i+1)
      WSHNetwork.RemovePrinterConnection colPrinters(i+1), true, true
      writelog("remove printer \\TNIKIT28\CANONMF3")
    end if
'		if instr(colPrinters(i+1), "TNIKIT28") > 0 then
'			MegaPrinter = 1
'		end if
    ' Поиск удаляемого принтера
    if instr(colPrinters(i+1), "BUH2") > 0 then
'			msgbox colPrinters(i) & chr(9) & colPrinters(i+1)
      WSHNetwork.RemovePrinterConnection colPrinters(i+1), true, true
      WSHNetwork.AddWindowsPrinterConnection "\\IRUDEN12\FX890"
      writelog("add printer \\IRUDEN12\FX890")
    end if
    if instr(colPrinters(i+1), "SECRETAR") > 0 then
'			msgbox colPrinters(i) & chr(9) & colPrinters(i+1)
      WSHNetwork.RemovePrinterConnection colPrinters(i+1), true, true
      WSHNetwork.AddWindowsPrinterConnection "\\TNIKIT28\CANONMF3"
      writelog("add printer \\TNIKIT28\CANONMF3")
    end if
  Next
  if MegaPrinter = 0 then
    WSHNetwork.AddWindowsPrinterConnection "\\TNIKIT28\ML1710"
    writelog("add printer \\TNIKIT28\ML1710")
  end if
End If

sub writelog (sLine)
    Set fList = fso.OpenTextFile("s:\b2user\temp\new_prn.log", ForAppending, True)
    fList.WriteLine sLine & " - " & now
    fList.Close
end sub

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question