Good afternoon everybody, please help with solving the problem on powershell

There is a shared printer \ printserv \ hp400 It needs to be connected via powershell for the remote pc1 machine for user user1 and set this printer as default

On all PC powershell 5.1

What I found myself: While on the local machine, the printer can be connected via the WMI method of the object ([wmiclass]'Win32_Printer').AddPrinterConnection("\\printserv\hp400") but how to do it remotely?

To make the default printer via WMI did not work (or I could not find the info), it also happened on the local machine via COM (New-Object -ComObject WScript.Network).SetDefaultPrinter('\\printserv\hp400') but again how to do it remotely could not find (

Thank you in advance for all the answers.

  • WinRM tried? - don Rumata
  • 1. To execute commands remotely, you can use the Invoke-Command cmdlet or the PSExec docs.microsoft.com/en-us/sysinternals/downloads/psexec utility. 2. To connect the printer, you can use printer management scripts located in the C:\Windows\System32\Printing_Admin_Scripts\ru-RU folder (for the English version of Windows, the final folder will be \en-US ). Usage examples are included in the header of each script. Or you can read here: techrepublic.com/blog/windows-and-office/… - n01d

0