This is my journey to removing my default windows printer.


  1. Posts : 42
    windows10
       #1

    This is my journey to removing my default windows printer.


    This is my journey to removing my default windows printer.

    I'm not an expert, so I used the method below.
    i think this is the best If there is a better way, please let me know.


    Caution
    Don't follow me. Please watch it for fun.
    And even if you delete it, it will be created again.


    sc config "Spooler" start= demand
    sc stop "Spooler"

    Back up before editing
    REG EXPORT "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments" d:\Print_Environments.reg

    REM "Environments find all enhanced drivers in the printer path"
    REG QUERY "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments" /k /f "Microsoft enhanced Point and Print compatibility driver" /s > %temp%\test.txt

    REM "Extract only the desired content from the entered test.txt and send it to 777.txt"
    findstr /C:"Microsoft enhanced Point and Print compatibility driver" %temp%\test.txt > %temp%\777.txt

    REM "Delete only that path"
    for /f "delims=" %i in ('type %temp%\777.txt') do set "aa=%i" & cmd /V:ON /C "REG delete "!aa!" /f"
    'Microsoft enhanced Point and Print compatibility driver' If you delete one, the following is when you delete several.


    REM "Environments find all enhanced drivers in the printer path"
    REG QUERY "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments" /k /f "Microsoft enhanced Point and Print compatibility driver" /s > %temp%\test.txt

    REM "Microsoft Shared Fax Driver Find > mark means add, not delete"
    REG QUERY "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments" /k /f "Microsoft Shared Fax Driver" /s >> %temp%\test.txt
    REG QUERY "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments" /k /f "Microsoft Print To PDF" /s >> %temp%\test.txt
    REG QUERY "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments" /k /f "Microsoft Software Printer Driver" /s >> %temp%\test.txt
    REG QUERY "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments" /k /f "Microsoft XPS Document Writer v4" /s >> %temp%\test.txt


    REM "Extract only the desired content from the entered test.txt and send it to 777.txt"
    findstr /C:"Microsoft enhanced Point and Print compatibility driver" %temp%\test.txt > %temp%\777.txt

    REM "Microsoft Shared Fax Driver find sentence"
    findstr /C:"Microsoft Shared Fax Driver" %temp%\test.txt >> %temp%\777.txt
    findstr /C:"Microsoft Print To PDF" %temp%\test.txt >> %temp%\777.txt
    findstr /C:"Microsoft Software Printer Driver" %temp%\test.txt >> %temp%\777.txt
    findstr /C:"Microsoft XPS Document Writer v4" %temp%\test.txt >> %temp%\777.txt

    REM "Delete only that path"
    for /f "delims=" %i in ('type %temp%\777.txt') do set "aa=%i" & cmd /V:ON /C "REG delete "!aa!" /f"


    REM "elimination targets"
    Microsoft enhanced Point and Print compatibility driver
    Microsoft Shared Fax Driver
    Microsoft Print To PDF
    Microsoft Software Printer Driver
    Microsoft XPS Document Writer v4


    REM claim in my power
    TAKEOWN /f "%windir%\System32\spool\drivers\x64\*" /r /d y
    icacls "%windir%\System32\spool\drivers\x64\*" /reset /T
    icacls "%windir%\System32\spool\drivers\x64\*" /grant Administrator:F

    TAKEOWN /f "%windir%\System32\spool\drivers\W32X86\*" /r /d y
    icacls "%windir%\System32\spool\drivers\W32X86\*" /reset /T
    icacls "%windir%\System32\spool\drivers\W32X86\*" /grant Administrator:F


    # Turn it on with powershell administrator privileges. Delete folder
    Remove-Item -Path "$env:SystemRoot\System32\spool\drivers\x64\[0-99]*" -Recurse -Force
    Remove-Item -Path "$env:SystemRoot\System32\spool\drivers\W32X86\[0-99]*" -Recurse -Force
    Remove-Item -Path "$env:SystemRoot\System32\spool\drivers\x64\PCC" -Recurse -Force
    Remove-Item -Path "$env:SystemRoot\System32\spool\drivers\W32X86\PCC" -Recurse -Force


    REM Device not installed (Remove the REM in front of it if you want to apply it.) Absolutely not recommended.
    REM reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DeviceInstall\Settings" /v "PreventDeviceMetadataFromNetwork" /t REG_DWORD /d "1" /f
    REM reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DeviceInstall\Settings" /v "PreventDeviceMetadataAndThirdPartyDriverDownload" /t REG_DWORD /d "1" /f

    REM Restrict printer access
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Spooler" /v EveryoneIncludesAnonymous /t REG_DWORD /d 0 /f
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Spooler" /v GuestAccess /t REG_DWORD /d 0 /f
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Spooler" /v GuestsAccess /t REG_DWORD /d 0 /f
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Spooler" /v IIS_IUSRSAccess /t REG_DWORD /d 0 /f
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Spooler" /v RemoteInteractiveLogonAccess /t REG_DWORD /d 0 /f
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Spooler" /v RemoteManagementUsersAccess /t REG_DWORD /d 0 /f

    REM Clear printer settings
    powershell.exe -Command "& {Get-ChildItem $env:SystemRoot\System32\spool\V4Dirs | Remove-Item -recurse}"

    C:\Windows\System32\spool\V4Dirs


    Windows Key + R
    printui /s /t2

    # powershell
    Get-Printer | Select-Object Name



    Make sure you have a printer.
    The above are my crappy way.

    Even so, it was recreated.

    Please watch it just for fun.
    I have a strong will to delete my default printer.

    :)

    This is my journey to removing my default windows printer.-44.png
    But I really wanted to delete this.
    Couldn't delete this.

    It's too difficult to delete this with a command.
    My hope is to delete this with a command.
    :)

    - - - Updated - - -

    REM Turn on with cmd administrator privileges
    sc config "Spooler" start= demand
    sc start "Spooler"

    # Here's what I've tried before. powershell
    Get-PrinterDriver | Format-List Name | Out-File -Encoding OEM "$env:temp\test.txt"
    Get-Content "$env:temp\test.txt" -Encoding OEM | ForEach-Object { $_ -replace "Name : ", "" } | Set-Content "$env:temp\777.txt" -Encoding OEM

    Get-Content $env:temp\777.txt | Where { $_.Replace(",","") -ne "" } | Out-File $env:temp\888.txt -Encoding OEM

    $file = Get-Content "$env:temp\888.txt"
    Get-Printer | Where-Object {$_.DriverName -eq "$($_.DriverName)"} | Remove-Printer

    $file = Get-Content "$env:temp\888.txt"
    Write-Output $file

    - - - Updated - - -

    REM Turn on with cmd administrator privileges
    sc config "Spooler" start= demand
    sc start "Spooler"

    # Here's what I've tried before. powershell
    Get-PrinterDriver | Format-List Name | Out-File -Encoding OEM "$env:temp\test.txt"
    Get-Content "$env:temp\test.txt" -Encoding OEM | ForEach-Object { $_ -replace "Name : ", "" } | Set-Content "$env:temp\777.txt" -Encoding OEM

    Get-Content $env:temp\777.txt | Where { $_.Replace(",","") -ne "" } | Out-File $env:temp\888.txt -Encoding OEM

    $file = Get-Content "$env:temp\888.txt"
    Get-Printer | Where-Object {$_.DriverName -eq "$($_.DriverName)"} | Remove-Printer

    $file = Get-Content "$env:temp\888.txt"
    Write-Output $file
      My Computer


  2. Posts : 17,015
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #2

    Why don't you just use the uninstall instructions / utility provided by the printer maker?

    Denis
    Last edited by Try3; 23 Mar 2023 at 13:09.
      My Computer


  3. Posts : 18,034
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #3

    Hello @krdondon,

    All I can say is WOW, that is a LOT of work for something that should be relatively simple to achieve.

    Why did you NOT check our Tutorials sections first like > Remove Printer in Windows 10 along with the Related Tutorials at the BOTTOM of the above Tutorial [ there are a few ] as they may also be related.

    I hope this helps.
      My Computer


  4. Posts : 42
    windows10
    Thread Starter
       #4

    I haven't installed the printer.
    This is a command to remove the printer installed by default in Windows.
    And I want to remove it easily with command.
    It is very inconvenient to find and click the mouse image.
    :)

    additional information.
    I wanted to automatically search and delete them.
    So all my commands are automatic.

    And I tried following the link you gave me, but I can't see it.
    It seems to be a Windows built-in printer.
    (What I'm looking for is a built-in printer inside Windows, so it doesn't look like a command. I don't know why.)
      My Computer


  5. Posts : 18,034
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #5

    Hello @krdondon,

    krdondon said:
    I haven't installed the printer.
    This is a command to remove the printer installed by default in Windows.
    And I want to remove it easily with command.
    It is very inconvenient to find and click the mouse image.
    Are you talking about this ? > Add or Remove Microsoft XPS Document Writer Printer in Windows 10

    I hope this helps.
      My Computer


  6. Posts : 7,920
    Windows 11 Pro 64 bit
       #6

    This is my simple approach:
    1. Uninstall whatever old driver you wish to remove
    2. Run the print management app. Delete any remaining instances of printers, drivers and servers not needed.
    3. Install the required printer driver.
      My Computers


  7. Posts : 42
    windows10
    Thread Starter
       #7

    Remove-Printer -Name "Microsoft XPS Document Writer"
    Not deleted. Failed. I can't figure out why.
    But it was clearly registered in my control panel.

    I deleted it this way today.
    pnputil /enum-devices /drivers > d:\install_drivers.txt

    REM "Microsoft Print to PDF"
    pnputil /remove-device "SWD\PRINTENUM\{403EA90E-6BDA-4EB4-9BB4-BC40E5920519}"

    This is how I deleted it.
    But it's cumbersome...


    So I want to try making it using powershell.(I am trying to erase other unused devices as a test)
    pnputil /enum-devices /drivers > d:\test.txt
    Get-Content d:\test.txt -Encoding Default | Out-File -Encoding UTF8 d:\777.txt

    인스턴스 ID: PCI\VEN_8086&DEV_8C22&SUBSYS_50011458&REV_05\3&11583659&0&FB

    $lines = Get-Content 777.txt
    $index = $lines.IndexOf("*SM 버스 컨트롤러*") - 1
    $result = for ($i = $index; $i -ge 0; $i--) {
    if ($lines[$i] -match "^인스턴스 ID*") {
    $lines[$i]
    break
    }
    }
    $result | Out-File -Encoding oem d:\888.txt


    I prayed like this, but failed.
    :)
      My Computer


  8. Posts : 7,920
    Windows 11 Pro 64 bit
       #8

    krdondon said:
    Remove-Printer -Name "Microsoft XPS Document Writer"
    Not deleted. Failed. I can't figure out why.
    But it was clearly registered in my control panel.

    I deleted it this way today.
    pnputil /enum-devices /drivers > d:\install_drivers.txt

    REM "Microsoft Print to PDF"
    pnputil /remove-device "SWD\PRINTENUM\{403EA90E-6BDA-4EB4-9BB4-BC40E5920519}"

    This is how I deleted it.
    But it's cumbersome...


    So I want to try making it using powershell.(I am trying to erase other unused devices as a test)
    pnputil /enum-devices /drivers > d:\test.txt
    Get-Content d:\test.txt -Encoding Default | Out-File -Encoding UTF8 d:\777.txt

    인스턴스 ID: PCI\VEN_8086&DEV_8C22&SUBSYS_50011458&REV_05\3&11583659&0&FB

    $lines = Get-Content 777.txt
    $index = $lines.IndexOf("*SM 버스 컨트롤러*") - 1
    $result = for ($i = $index; $i -ge 0; $i--) {
    if ($lines[$i] -match "^인스턴스 ID*") {
    $lines[$i]
    break
    }
    }
    $result | Out-File -Encoding oem d:\888.txt


    I prayed like this, but failed.
    :)
    Can't you just delete all instances of that XPS driver from Print Management e.g.?
    This is my journey to removing my default windows printer.-capture.jpg
      My Computers


  9. Posts : 42
    windows10
    Thread Starter
       #9

    I don't have a printer manager. Didn't install. I didn't even install the printer.. haha;;
    It's the Windows home version, so there's no.

    Today, I asked AI.. I succeeded by making it as follows.
    I have so much fun. I want to brag about learning.
    :)
    Windows-Start/단어 두개 찾아서 실행하기.txt at main . oklokl/Windows-Start . GitHub

    Thank you so much for your reply.. I'll write a note

    Oh, and I wanted to do it with a command.
    I hate clicking on images...
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 19:15.
Find Us




Windows 10 Forums