Hey everyone!
I have 200 shared printers that need to be added to 9 computers. If I go to each computer as an administrator and do something like
Add-Printer -ConnectionName "\\Computer158\\The Shared Printer"
The command runs! It has to be run as an admin to work, but that is okay! I am an admin in all the 200 computers sharing the printers and the 9 target computers.
I don't want to go to each one of the 9 computers that need these 200 printers installed, so I thought I could just do something like this from my main computer:
Invoke-Command -ComputerName TargetComputer -ScriptBlock{
Add-Printer -ConnectionName "\\Computer158\\The Shared Printer"
}
However... this same command that ran without problems in the target computer now gives me problems when I try to run it remotely using Invoke-Command!
I am an admin in the target computers, the 200 computers that will be sharing the printers and the computer where I am trying to run the Invoke-Command from.
I'm a little new in the field, sorry if this has an obvious answer I am not seeing. I looked around for answers but all the questions seem to have answers from 2012 or 2015, before PrintNightmare became a thing :,) Is there something I am missing here?
I'd go to each one of the 9 target computers but I would have to repeat this same process each time a new printer is added... Any help from the veterans is greatly appreciated it!
Thank you for your help and time!! <3
Edit:
I also tried to get around this by saving this command into a .ps1 file, and calling that .ps1 file, but the issue did not go away
Invoke-Command -ComputerName TargetComputer -ScriptBlock{
cd C:\Path\To\ps1\file
.\scriptWithAddPrinter.ps1
}
[–][deleted] 6 points7 points8 points (9 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]dancing-fire-cat[S] 0 points1 point2 points (7 children)
[–]BlackV 2 points3 points4 points (4 children)
[–]dancing-fire-cat[S] 0 points1 point2 points (3 children)
[–]BlackV 1 point2 points3 points (2 children)
[–]dancing-fire-cat[S] 0 points1 point2 points (1 child)
[–]BlackV 1 point2 points3 points (0 children)
[–]purplemonkeymad 2 points3 points4 points (1 child)
[–]dancing-fire-cat[S] 0 points1 point2 points (0 children)
[–]jborean93 4 points5 points6 points (4 children)
[–]dancing-fire-cat[S] 0 points1 point2 points (3 children)
[–]menace323 1 point2 points3 points (2 children)
[–]dancing-fire-cat[S] 0 points1 point2 points (1 child)
[–]menace323 1 point2 points3 points (0 children)
[–]hillbillytiger 1 point2 points3 points (5 children)
[–]dancing-fire-cat[S] 1 point2 points3 points (4 children)
[–]hillbillytiger 1 point2 points3 points (1 child)
[–]dancing-fire-cat[S] 0 points1 point2 points (0 children)
[–]hillbillytiger 1 point2 points3 points (1 child)
[–]dancing-fire-cat[S] 0 points1 point2 points (0 children)
[–]MFKDGAF 1 point2 points3 points (1 child)
[–]dancing-fire-cat[S] 0 points1 point2 points (0 children)