Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printers not getting removed from the client when deselected in FOG web interface #90

Open
Sebastian-Roth opened this issue Jul 25, 2017 · 3 comments
Assignees

Comments

@Sebastian-Roth
Copy link
Member

Sebastian-Roth commented Jul 25, 2017

Following up this post in the forums. I am able to replicate this issue on a Windows 7 32 bit system. I am fairly sure this applies to 64 bit version as well.

Adding debug statements to the code I found that WindowsPrinterManager.GetPrinters() does not return a list of currently installed printers as we would expect.

To me this seems to be caused by FOGService running as local system account whereas the printers/printer connections are obviously only visible in the user context. Try running the following VBscript as normal user (double click or wscript.exe C:\path\to\printer.vbs from cmd.exe) and under local system privileges (this is done using PsExec.exe -i -s cmd.exe /C wscript.exe C:\path\to\printer.vbs, see here):

Set objNetwork = CreateObject("Wscript.Network")

Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colPrinters = objWMIService.ExecQuery ("SELECT* FROM Win32_Printer")

For Each objPrinter In colPrinters
WScript.Echo objPrinter.Name & vbCrLf
Next

WScript.Echo "done"

Running it as user I get both local printers and the network printer configured by the FOG client. But as local system account I only get the local printers.

@Sebastian-Roth
Copy link
Member Author

Sebastian-Roth commented Jul 25, 2017

There are several hints on the net that others have similar problems, e.g. here and here.

Right now I am looking into reading the printer information directly from the registry. Looks as if this could be the way to go.

@Sebastian-Roth
Copy link
Member Author

Alright, here is a first test DLL which reads printer information from the registry instead of using WMI calls. This works great on my test VM - win7 32 bit.

net stop fogservice
rename "C:\Program Files\FOG\Modules.dll" Modules_orig.dll
cd C:\path\to\extracted\modules\file
move Modules.dll "C:\Program Files\FOG\"
  • make sure you have a network printer configured for this client
  • reboot your client, login and check the FOG client log
  • see if the printer comes up in Control Panel -> Devices and Printers
  • de-select printer from that client in the FOG web GUI
  • check FOG client log and Control Panel

@Sebastian-Roth
Copy link
Member Author

As we don't have many people using the new fog-client release 0.11.17 including that change we shall wait a little bit more to see what happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant