Delete remote local printer Windows 7

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 5 years, 10 months ago.

  • Author
    Posts
  • #5774

    by fjumayao at 2013-04-05 08:53:55

    Headstart PS User here, hoping to move up to Kindergarten in a few weeks.....

    Been Googling this but have not found a specific answer, can I delete a tcpip/local printer remotely with powershell?

    by MasterOfTheHat at 2013-04-05 09:26:37

    Should be able to! Take a look here: http://technet.microsoft.com/en-us/library/dd347648.aspx and here: http://technet.microsoft.com/en-us/library/hh849719.aspx

    You'll basically include the syntax from the first link as the ScriptBlock parameter in the Invoke-Command cmdlet from the second link. I'm sure someone out here has real-world experience with it, too.

    by Nobody at 2013-04-05 09:32:12

    You can use Get-WMIObject to get the printer object from the remote computer, then use the delete method of the object to delete the printer.


    $a = get-wmiobject -computername computer -query "SELECT * FROM win32_printer WHERE name = 'PrinterName'"
    $a.delete()

    by fjumayao at 2013-04-05 10:45:11

    Worked like a charm – awesome!

    Thank you for the prompt reply and the assistance.

You must be logged in to reply to this topic.