

- CHANGE PRINTER NAME WINDOWS 8 INSTALL
- CHANGE PRINTER NAME WINDOWS 8 PRO
- CHANGE PRINTER NAME WINDOWS 8 CODE
However, this "advice" and point of mine is in the context of desktop software. Quite sure your example is "by design", and you are able to change the default printer - but it ONLY persists during the running of that program, so it don't effect every other program. In above, I change the printer, and then exit and re-start (f5) from VS, and the setting does persist.Īnd if I check in system (printers) - it also been changed.Īnd here is a routine to get default printer. Public static extern bool SetDefaultPrinter(string Name) Protected void cmdSetPtr_Click(object sender, EventArgs e) ListItem PtrItem = new ListItem(PrinterName) PrinterSettings OnePrinter = new PrinterSettings() įoreach (string PrinterName in PrinterSettings.InstalledPrinters)
CHANGE PRINTER NAME WINDOWS 8 CODE
However, you can change the current computer default.Īnd code behind: protected void Page_Load(object sender, EventArgs e) Ok, as a general rule, if you change the default, it only works for your current desktop session.

How can I detect the default printer without rebooting every time it is changed? On the off chance I've tried restarting the Print Spooler service and the Printer Extensions and Notifications service and also tried stopping and starting the Application Pool (In IIS), I've stopped Visual Studio 2022 runnign the website and rebuilt it and rerun it, but the only thing I can find that works is a system reboot!?!?!?
CHANGE PRINTER NAME WINDOWS 8 INSTALL
I've also noticed that if I install a new printer and set that as default then that will be detected as the default printer without requiring a system reboot. The issue is that with both methods will work correctly after a system reboot, however if I change the default printer on a system and then run the above code it shows me only the default printer when the system restarted (not the currently selected default printer (marked as default in windows printers and devices screen)). String defaultPrinterName = printerSettings.PrinterName String defaultPrinterName = string.Empty įoreach (ManagementObject printer in printerCollection)īool isDefault = (bool)printer ĭefaultPrinterName = printer.ToString() Īnd PrinterSettings printerSettings = new PrinterSettings()

ManagementObjectCollection printerCollection = searcher.Get() ManagementObjectSearcher("SELECT * FROM Win32_Printer") I am trying the following two methods: using System.Management it marks the appropriate printer with the 'default' tag. Is there a way to prevent this? Or perhaps to clear the cache so that a reboot isn't required?Ĭhanging the default printer seems to work in the windows OS interface, i.e. Rebooting the system can clear the cache and force Windows to re-evaluate the printer configuration. In some cases, the cached information may not reflect the latest changes made to the default printer. I understand that Windows may cache printer information, including the default printer, to improve performance.
CHANGE PRINTER NAME WINDOWS 8 PRO
I'm trying to reliably detect the default printer that is set on a machine using asp.net c# while running the website in debug mode using Visual Studio 2022 on a Windows 11 pro machine. EDIT START 08/062023 - I will delete this question shortlyĪfter deploying this onto a Windows 2019 server the issue disappears, it seems that this behaviour is only exhibited on Windows 11.
