ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Control Panel>Devices and Printers object locations?

    IT Discussion
    3
    4
    322
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Mr. JonesM
      Mr. Jones
      last edited by Mr. Jones

      So I'm learning to code powershell and I'm playing around with writing my own script to target and delete network xerox printers and printer drivers from a machine locally. I'm having issues where when I run the following scripts:

      PS C:\Windows\System32> Get-Printer | where{$_.Name -like "*Xerox*"} | Remove-Printer
      

      &

      PS C:\Windows\System32> Get-PrinterDriver | where{$_.Name -like "*Xerox*"} | Remove-PrinterDriver
      

      The scripts work, as Get-Printer, Get-PrinterDriver verify that they no longer exist, but they still show up greyed-out in Control Panel>Devices and Printers. (rebooting machine doesn't make them go away either).

      A bit of trial and error to be sure I couldn't figure it out before I asked you all was to additionally delete any match to "Xerox" in registry, and a complete removal of all files in the following directories:

      C:\Windows\System32\Spool\Servers\*
      C:\Windows\System32\Spool\Drivers\x64\*
      C:\Windows\System32\Spool\Printers\*
      C:\Windows\System32\DriverStore\FileRepository\*Xerox*

      I'm obviously looking for a way to streamline this process, so without opening Control Panel via GUI, and manually deleting them, I'd like to do it with script. This isn't a request for a script however, but a request for information regarding the location of these objects, or any experience in regards to deleting them.

      JaredBuschJ 1 Reply Last reply Reply Quote 1
      • JaredBuschJ
        JaredBusch @Mr. Jones
        last edited by

        @mr-jones this is what I use.

        It is not 100% but I have never noticed a left over printer.
        https://mangolassi.it/post/413461

        Mr. JonesM 1 Reply Last reply Reply Quote 0
        • Mr. JonesM
          Mr. Jones @JaredBusch
          last edited by

          https://mangolassi.it/post/413461

          Oh look, G I Jones, I remember that guy.

          Anyway, this is adding a network printer... I don't think this helps at all to be honest. Did you misread the post? Am I missing something?

          DashrenderD 1 Reply Last reply Reply Quote 0
          • DashrenderD
            Dashrender @Mr. Jones
            last edited by

            @mr-jones said in Control Panel>Devices and Printers object locations?:

            https://mangolassi.it/post/413461

            Oh look, G I Jones, I remember that guy.

            Anyway, this is adding a network printer... I don't think this helps at all to be honest. Did you misread the post? Am I missing something?

            it does have one line that removes a port

            Remove-PrinterPort -name $PrinterPort

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post