FOG 1.5.4.8 : Printer Management : config file field missing ?


  • Hi !

    I’m using the Printer Management to push the printer on the computers. It’s work flawlessly.

    But now, i want to deploy a specific configuration of the printer : with theses commands, i can export and/or import a configuration :

    export : RUNDLL32 PRINTUI.DLL,PrintUIEntry /Ss /n"Printer Name" /a Path\ConfigFile.dat m f g p
    
    import : RUNDLL32 PRINTUI.DLL,PrintUIEntry /Sr /n"Printer Name" /a Path\ConfigFile.dat m f g p
    

    I saw a special field on FOG Printer Management named “conf file” but i can’t use / edit this field.

    There, 2 screenshots for better explanation : https://drive.google.com/drive/folders/1EjICoI8wM3DvKuyOlsbYO6_Wry-9RV91?usp=sharing

    Maybe i did a mistake ?

    Thank you 🙂


  • Sorry, I’ll post a new topic.

    After lots of trying I’ve been able to deploy printers. The main problem was the name of the printer, which is not clear what it should be.

    I’ve put the details in a new topic: https://forums.fogproject.org/topic/14891/problems-deploying-printers

    Thanks for your help!

  • Senior Developer

    @jaumeramos Definitely Check the share access as posted by JJ!

    There is enough room in the forums. No need to hijack other topics. May I ask you to open your own and post all the details there? The less things are mixed up in one thread the better support we can give.

    Just open a new one and we can move the posts over for you.

  • Testers

    @Jonathan-Cool Were you able to get the config file deployment to work?

    Also, we’re (slowly) moving the documentation to a new home and I started updating the printer management section https://fogproject.readthedocs.io/en/latest/management/index.html#printer-management


  • @JJ-Fullmer Many thanks for the lot of informations 😉
    After i update my fog server, i will use your precious informations to deploy my printers.

    I will be back ! 😉


  • @JJ-Fullmer A lot of the new client’s printer documentation is in the forums. The wiki does need updated concerning printers.

  • Testers

    So I didn’t find any clear documentation on how this is done. So we probably need to add it to the wiki @Wayne-Workman

    Probably to here https://wiki.fogproject.org/wiki/index.php?title=Managing_FOG#Setting_up_Printers_With_Fog_Printer_Management

    even something as simple as

    updating this section

    To create a new printer definition click on the Printer icon on the system menu bar. Then on the left hand menu, click on Add New Printer. The form you are presented with will require you to enter:

    Printer Model - This must match the name in the INF file.
    Printer Alias - This can be anything you wish and it is what the end user will see.
    Printer Port - This is something like LPT1:, or IP_1.1.1.2.
    Printer INF File - This is the path to the INF file for the printer driver.
    Printer IP - (optional) This is ip address of an IP based printers only, this can take the form of 1.2.3.4:9100 or 1.2.4.5. If the port doesn’t exist already, it will create one named IP_x.x.x.x, where x.x.x.x is the ip address. That is what should be entered in the port field.

    After all the required information is entered, click on the Add Printer button.

    With this under the Printer IP definition

    Printer Config File - (Optional) This is the local or remote path to a .dat file that will be imported to set the printers configurations (i.e. tray count, add-on modules, model specific settings, etc.). You can create this file by

    1. manually configuring a printer via the printer properties gui
    2. running this command on the same computer RUNDLL32 PRINTUI.DLL,PrintUIEntry /Ss /n"Printer Name" /a "C:\Path\To\Save\ConfigFile.dat m f g p

    Of course if someone wants to create the evolution of the printer manager I suggested, it would have to be re-documented. But people would still need to know how to create the config file.

  • Testers

    TL;DR

    Try putting the .dat file the same place you put your inf driver file for the printer and reference them on the same path. i.e. either a local path on the client computer or a publicly accessible file share.

    As I mentioned though, I don’t use the fog print manager anymore. So I don’t have a way to test it currently.

    Found some code, sorta remember how it works

    Well I found the pull request commit on the fog client github from when @Joe-Schmitt put in the code I wrote for adding the config file https://github.com/FOGProject/fog-client/commit/57af21cdbbe79a9bd403056b1ea88f88af722ecf.
    Both the posts I referenced earlier were for before this code was added, so they probably won’t be any help in figuring out where that config file is supposed to go.

    And then I found where that code is now, on line 124 of this file fog-client https://github.com/FOGProject/fog-client/blob/master/Modules/PrinterManager/Windows/WindowsPrinterManager.cs,
    which looks like this

    public override void Configure(Printer printer, bool verbose = false)
            {
                if (printer.Type == Printer.PrinterType.Network)
                {
                    Log.Entry(LogName, $"Invoking add {printer.Name} for all users");
                    PrintUI($"/in /n \"{printer.Name}\"", verbose);
                }
    
                if (string.IsNullOrEmpty(printer.ConfigFile)) return;
    
                Log.Entry(LogName, "Configuring " + printer.Name);
                PrintUI($"/Sr /n \"{printer.Name}\" /a \"{printer.ConfigFile}\" m f g p", verbose);
            }
    

    As far as I can tell/remember from the code that it takes the given path and puts it into the command, which is the csharp version of the one you already know. So, I believe, it’s taking whatever you put in that field as a string and putting it in the command.

    So if you put C:\printerConfig.dat in your config field it would run RUNDLL32 PRINTUI.DLL,PrintUIEntry /Sr /n"Printer Name" /a "C:\printerConfig.dat" m f g p after it adds the printer, which should import your config.

    So it could either be a file on a share the system account (that runs the fogservice) has access to, or a file that is already local on the client computer. So I think it works the same way the inf does where the file just needs to be somewhere that is helpful.

    I feel like we (or probably @Joe-Schmitt ) also made a helper tool for creating the dat files, and I see a folder in the code called PrinterManagerHelper here https://github.com/FOGProject/fog-client/tree/master/PrinterManagerHelper but I don’t remember how that works.

    Ways to deploy printers

    To deploy it a bit more smoothly you might…

    Print Share

    Consider creating a public samba share (or at least give it permissions for system/machine accounts) for sharing an organized structure of print drivers and config files. Then point each printer field as something like \\printshare\printerName\printerName-config.dat \\printShare\printerName\printerName-driver.inf

    Snapin

    You could also create a simple snapin for each printer, that copies the driver and dat files to some folder that works with your company’s organization. Like a C:\ProgramData\FogPrinters folder or something like that. And then maybe making a scheduled task or another snapin to delete them after fog adds the printers (no need to take up space on client computers with config files)

    Feature Request

    Maybe, if it’s desired by people, we could add functionality to copy files from the snapins folder (or a new fogserver folder) to a temporary folder while the printer gets installed and then deletes them from the temp folder. Once the printer is added I believe the driver gets put in the system driver store and the config file is no longer needed as its been imported. That would make the print functions of fog a bit more integrated and you could just manage the files in fog like you do with snapins.

    But this would require

    • Creating a new server folder
      • at least a subfolder in the existing snapins, i.e /opt/fog/snapins/printers or even just make a /opt/fog/printers.
    • A modification to the printer gui page
      • Instead of specifying a path to the inf and config file, browse buttons and use existing dropdowns like the snapins have
    • A code change to the printer manager
      • make it work like the snapins code. where it copies down the files from the snapins folder, runs it, then deletes it. Just make it be from a printer folder that works like the snapins.
    • Probably something else too I’m not thinking of. But if lots of people use the printer manager, could be a useful tool.
  • Testers

    @Jonathan-Cool So I found my old post where I mentioned those exact commands you put in your original post
    https://forums.fogproject.org/topic/6540/adding-custom-printer-configuration plus it has a bat script (which is a language I don’t even use anymore since I moved everything to powershell)

    So it is the .dat file that you want but where it resides, I’m trying to find that info.

    I was a bit long winded when I tried to help someone else with something related here https://forums.fogproject.org/topic/6615/printer-problems/5

    I am sure I made some sort of documentation post somewhere though just gotta find it and then make sure it gets put somewhere more findable

  • Testers

    @Jonathan-Cool So I helped a lot with that field’s existence. I actually don’t use that feature anymore since I switched our infrastructure to just use a print server to deploy printer connections and settings (point being, I don’t actually remember how to use it…). But I’m pretty sure I have an old forum post explaining how to create a setting file from a configured printer. Standby, I’ll see if I can find it.


  • @Tom-Elliott Hi !
    Thank you for your answers. I will try to update to the last stable version.
    I will be back to post the result.

    So, i can’t find any documentation about this field … maybe just set a path to the .dat file … i guess.

  • Senior Developer

    Looks like this was fixed in 1.5.6.

    Here’s the relevant commit: https://github.com/FOGProject/fogproject/commit/fffeae85a38ee026ddadd83131579eddbdb8fefa

  • Senior Developer

    From what I can tell:

    1.5.4 was missing the items for this accidentally.

    Doing a compare from 1.5.4 to 1.5.9, I see that the config items have been added.

    Maybe updating your instance will provide you with the missing items?

274
Online

7.6k
Users

14.7k
Topics

138.3k
Posts