Skip to content

Instantly share code, notes, and snippets.

@AdilHindistan
Created April 12, 2014 18:46
Show Gist options
  • Select an option

  • Save AdilHindistan/10550527 to your computer and use it in GitHub Desktop.

Select an option

Save AdilHindistan/10550527 to your computer and use it in GitHub Desktop.
##AH - AdilHindistan - PSMon
#post: http://www.adilhindistan.com/2013/08/work-around-printuidll-quirkiness-on-xp.html
Remove all under
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices\
RegSetValue - Add printers
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices\
HKCU\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts
Read
HKLM\SYSTEM\CurrentControlSet\Control\Print\Connections
HKU\S-1-5-19\Printers\Connections\
Create/Set
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports\Ne00:
HKU\S-1-5-19\Software\Microsoft\Windows NT\CurrentVersion\Devices\\\prtclinical01\acc18flprt8pl
HKU\S-1-5-19\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts\\\prtclinical01\acc18flprt8pl
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports\Ne01:
HKU\S-1-5-19\Software\Microsoft\Windows NT\CurrentVersion\Devices\\\prtclinical01\J3CHILDPRN2 winspool,Ne01:
HKU\S-1-5-19\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts\\\prtclinical01\J3CHILDPRN2 winspool,Ne01:,15,45
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\LanMan Print Services\Servers\prtclinical01\Printers\J3CHILDPRN2
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\LanMan Print Services\Servers\prtclinical01\Printers\J3CHILDPRN3
PrintUIEntry creates:
HKLM\System\CurrentControlSet\Control\Print\Connections\,,prtadmin01,1PK11-055
Spooler (going through HKCU SIDS):
SID S-1-5-19:
Creates a new connection and Clones the values from HKLM to
HKU\S-1-5-19\Printers\Connections\,,prtadmin01,1PK11-055
Queries and creates a new port
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Ports\ /v NeXX: /t Reg_SZ
where NeXX: Ne00 through Ne99 ?
Creates the following entries
HKU\S-1-5-19\Software\Microsoft\Windows NT\CurrentVersion\Devices\ /v \\prtadmin01\1PK11-055 /t Reg_SZ /d Winspool,NeXX:
HKU\S-1-5-19\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts\ /v \\prtadmin01\1PK11-055 /t Reg_SZ /d Winspool,NeXX:,15,45
SID S-1-5-20:
Creates a new connection and Clones the values from HKLM to
HKU\S-1-5-20\Printers\Connections\,,prtadmin01,1PK11-055
Queries and creates a new port
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Ports\ /v NeXX: /t Reg_SZ
where NeXX: Ne00 through Ne99 ?
Creates the following entries
HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\Devices\ /v \\prtadmin01\1PK11-055 /t Reg_SZ /d Winspool,NeXX:
HKU\S-1-5-20\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts\ /v \\prtadmin01\1PK11-055 /t Reg_SZ /d Winspool,NeXX:,15,45
SID: S-1-5-21-117609710-1958367476-725345543-149837
Creates a new connection and Clones the values from HKLM to
HKU\S-1-5-21-117609710-1958367476-725345543-149837\Printers\Connections\,,prtadmin01,1PK11-055
Queries and creates a new port
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports\ /v NeXX: /t Reg_SZ
HKU\S-1-5-21-117609710-1958367476-725345543-149837\Software\Microsoft\Windows NT\CurrentVersion\Devices\ /v \\prtadmin01\1PK11-055 /t Reg_SZ /d Winspool,NeXX:
HKU\S-1-5-21-117609710-1958367476-725345543-149837\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts\ /v \\prtadmin01\1PK11-055 /t Reg_SZ /d Winspool,NeXX:,15,45
SID: HKCU
Creates the Connection Entry Key & Clones the values from HKLM
HKCU\Printers\Connections\,,prtadmin01,1PK11-055
Assigns port
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices\ /v \\prtadmin01\1PK11-055 /t Reg_SZ /d Winspool,NeXX:
HKCU\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts\ /v \\prtadmin01\1PK11-055 /t Reg_SZ /d Winspool,NeXX:,15,45
SID: .DEFAULT
HKU\.DEFAULT\Printers\Connections\,,prtadmin01,1PK11-055
Queries and creates a new port
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports\ /v NeXX: /t Reg_SZ
HKU\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\Devices\ /v \\prtadmin01\1PK11-055 /t Reg_SZ /d Winspool,NeXX:
HKU\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts\ /v \\prtadmin01\1PK11-055 /t Reg_SZ /d Winspool,NeXX:,15,45
*************
Create key and fill in all information about printer, share, server etc. Rather large entry.
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\LanMan Print Services\Servers\prtadmin01\Printers\1PK11-055
Test:
Create a printer Entry (BBLanier1) under HKLM, log off / log back in as a different user
00:44:20 - checks for HKCU Connections value , detects it does not exist and creates it. also assigns a port (steps above)
00:45:39 - queries it but does not do anything yet (printers and devices show 'opening')
00:45:43 - queries it but does not do anything yet (printers and devices show 'opening')
00:45:48 - queries it but does not do anything yet (printers and devices show 'opening')
00:45:58 - queries it but does not do anything yet (printers and devices show 'opening')
00:46:07 - queries it but does not do anything yet (printers and devices show 'opening')
00:46:11 - queries it but does not do anything yet (printers and devices show 'opening')
00:46:19 - queries it but does not do anything yet (printers and devices show 'opening')
00:46:27 - queries it but does not do anything yet (printers and devices show 'opening')
00:46:31 - Queries LanMan Print Services, detects it is missing. Creates the key and fills in the information:
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\LanMan Print Services\Servers\prtadmin01\Printers\BBLanier1
Periodically (every 10secs) checks the following key
HKCU\Printers\Connections\,,prtadmin01,BBLanier1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment