Skip to content

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

Open
@Sebastian-Roth

Description

@Sebastian-Roth

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions