Exposing printer settings to the SYSTEM account
When a printer is installed on a computer, its settings are stored in the HKEY_CURRENT_USER registry key. IIS runs under the context of the local SYSTEM account. It has access to the HKEY_USERS registry key, but not to the HKEY_CURRENT_USERS subkey, which is only available to a user logged on to the computer.By default, no printers are defined in the HKEY_USERS key. You can add them by exporting three keys from the HKEY_CURRENT_USERS key and importing them to the HKEY_USERS key
NoteCaution Incorrectly editing the registry might severely damage your system. Make sure you back up valued data before making changes to the registry.
To make printer settings available to the SYSTEM account:
- Check that the current user on the Web server has the required printer(s) installed.
- To launch the Registry Editor, type regedit in the Start>Run dialog box and click OK.
- Select the HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion key and export the registry key from the File or Registry menu.
- Specify a name and location in the Export Registry File dialog box and click Save.
- This file provides a backup if you need to restore the registry.
- In the HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion key, select the Devices subkey and export the registry key.
- Specify the name devices.reg and a temporary location in the Export Registry File dialog box and click Save.
- Repeat steps 5 and 6 for the PrinterPorts and Windows subkeys, naming the files printerports.reg and windows.reg.
- Open devices.reg in Notepad (do not use TextPad or another editor), replace the string HKEY_CURRENT_USER with the string HKEY_USERS\.DEFAULT (note that there is a dot before DEFAULT), and save the file.
- Repeat step 8 for printerports.reg and windows.reg.
- Double-click each of the edited files to import them into the registry.
- Restart IIS so that the configuration changes take effect.
No comments:
Post a Comment