Snapin Questions



  • I am starting to play around with Snapins with Fog. The only thing is, I do not know how it works. While looking at the Wiki and other sources, I cant find a good “How-To” on how the snapins work and best practices. If someone can point me in the right direction, that would be great!


  • Moderator

    @Kiweegie said in Snapin Questions:

    While Jbobs description of snapins as files which get executed remotely is spot on, the real benefit of using snapins is in conjunction with silent switches so the installation happens without your users seeing anything going on. This avoids them having to call the Helpdesk because “some weird screen just popped up on my 'puter!”

    I wanted to say that if you’re using the new FOG Client, there will never be a display from a snapin - ever. At least not directly. This is because all snapins with the new FOG Client run as the SYSTEM user, which is prohibited from displaying anything to the user at all in Windows. This is by design of Windows itself. If your snapin isn’t silent, or properly configured to run silently, your snapin will infinitely hang. Hanging is a sure sign of a snapin waiting for input that will never come.


  • Moderator

    @gwhitfield said in Snapin Questions:

    @Joe-Schmitt Alrighty then, I’ll work with that. Thanks!

    It’s not perfect yet, but here is what we have so far:
    https://wiki.fogproject.org/wiki/index.php?title=SnapinPacks



  • @Kiweegie

    Very enlightening! I’ve been banging my noggin on the wall for weeks trying to figure snappins out. Thanks for posting! I’m so glad I found this thread!

    +1 for adding to wiki!!

    Cheers,

    Joe



  • @Wayne-Workman Sure will, probably take me an hour to dig out from other tasks but I’ll upload asap. THANK YOU!


  • Moderator

    @gwhitfield Can you give us the fog.log ? It’s basically the first and only way of troubleshooting the fog client.



  • @Joe-Schmitt It all seems straightforward enough but when the zip file gets to the tmp directory, fog.log says its extracting the file but it doesn’t extract and fails saying it can’t find specified file. Is there anything special about how the zip file is created? I just zipped up my 3 files using 7-zip.



  • @Joe-Schmitt Alrighty then, I’ll work with that. Thanks!


  • Senior Developer

    @gwhitfield I’ll keep it short for now and then work with Wayne on a wiki article for snapin packs
    Basically you created a SFX exe. So you are executing a single file, not multiple, from the clients perspective. Therefore it would be a normal snapin.

    A snapin pack is where you upload just a zip file and tell the client what files inside of that zip to run.



  • @Joe-Schmitt Having trouble getting this to work to install Adobe Reader DC with a transform file. The plain Adobe reader executable installs fine as a normal snapin but doesn’t download or use the transform. If I create an SFX .exe with the installer and .mst file and set up a snapin pack, it downloads but doesn’t extract saying “cannot find central directory” and fails. Any advice/updated process based on the newest 1.3RC4? I can start a new thread but this still seemed likely to come up in most searches.

    Edit: @Tom-Elliott @Wayne-Workman - Still fine to wait for RC5 but the problem with replacing “.” with “_” in my “Need snapin assistance” thread isn’t happening in my RC1 server so I thought I’d keep working on learning the process which resulted in this different question. Not trying to confuse with multiple threads on same problem.



  • @LJedi Hi there, snapins will make your life a lot easier. Once you get the hang of them (and they’re really not that hard) you’ll wonder how you managed without them. The pure joy to be had from deploying a new application to a group of 10’s or 100’s of machines in a couple of clicks and then just getting on with your day is pretty awesome :)

    I tend to forget things so I’ve created myself an idiots guide to most things I come across in FOG-land, snapins being no exception. I’ll outline the bits and pieces I’ve picked up, some of which you may already know.Jbobs answer was pretty succinct. I’m just going to dumb it down a little.

    While Jbobs description of snapins as files which get executed remotely is spot on, the real benefit of using snapins is in conjunction with silent switches so the installation happens without your users seeing anything going on. This avoids them having to call the Helpdesk because “some weird screen just popped up on my 'puter!”

    First off default FOG installation has a limit set on the size of snapins which can be uploaded to the server. This is configured in the php config file which in CentOS can be found at /etc/php.ini. You want to edit this file and locate these 3 sections and amend from 128M or 100M to 1900M

    memory_limit = 1900M
    post_max_size=1900M 
    upload_max_filesize=1900M
    

    Save the file and restart httpd service to have the changes kick in

    service httpd restart
    

    As far as actually creating snapins - the 2 biggest gotchas I found are:

    • snapin names can’t have spaces
    • uploaded files must be unique

    When naming the snapin in the UI either use CamelCase or throw in an underscore to split words up.

    The actual executable eg setup.exe is uploaded to FOG server in /opt/fog/snapins directory, not the name you give it in the web UI. The server won’t permit files of the same name in one directory. So if you have multiple versions of an installer for instance or need to create an uninstall snapin, make sure to rename the executable or MSI file so it’s unique. I add a version number or append _install, _uninstall depending on the situation.

    I have had greatest success with MSI files. To create a snapin from an MSI file you need to add in the following details.

    Snapin name - No spaces
    Snapin run with - c:\windows\system32\msiexec.exe
    Snapin run with argument use either /i or /x
    /i = install
    /x = uninstall
    Snapin file - upload in .MSI format. If doing an uninstaller as well, amend the file name prior to upload so its different on server.
    Snapin arguments - /qn - this is the the “no UI” switch for the MSI installer

    Some EXE files which come with well documented silent install switches also work well but you sometimes have to hunt high and low to find the switches or use a bit of trial and error,

    We use screenpresso screen capture tool at work and that has decently documented switches. Screenshot of this here. Note that screenpresso downloads always show as just screenpresso.exe - due to dupe file name mentioned earlier I rename this based on version before uploading to FOG.

    0_1452207146643_2016-01-07_22h51_16.png

    I’ve never had much joy with deploying .bat or .cmd files via FOG snapin but will be giving that a go again shortly based on Jbobs comment earlier. What I’ve used instead is create the .bat as normal then use BatToExe converter to convert to exe then just add a name and upload the .exe to FOG - all silent switches go in the .bat file so nothing needs added to FOG.

    TeraTerm is one such application I’ve deployed in this manner using this code. We have preconfigured keyboard, window and font settings using the keyboard.cnf and teraterm.ini files.

    @echo off
    
    :: script to copy teraterm.exe and config files to temp folder and install from there
    :: the /y switch tells xcopy to overwrite file at destination if it already exists.
    
    xcopy /y "\\server-share\TeraTerm\teraterm-4.89.exe" %TEMP%
    xcopy /y "\\server-share\TeraTerm\KEYBOARD.CNF" %TEMP%
    xcopy /y "\\server-share\TeraTerm\TERATERM.ini" %TEMP%
    
    :: install teraterm using the keyboard.cnf and teraterm.ini files specified
    %TEMP%\teraterm-4.89.exe /VERYSILENT
    
    :: lastly move the copied teraterm.ini and keyboard.cnf files into program files directory
    xcopy /y %TEMP%\KEYBOARD.CNF "C:\Program Files (x86)\TeraTerm\"
    xcopy /y %TEMP%\TERATERM.ini "C:\Program Files (x86)\TeraTerm\"
    

    Save as a bat file, run through BatToExe to output as .exe and upload to FOG and bam - done. Though you may not even need to save as a .exe. I shall test that myself tomorrow.

    Give it a go on a test machine and see how you get on - any questions feel free to ask.

    Other much more learned and savvy folks will no doubt chime in with even better suggestions or pointers should you need them.

    cheers, Kiweegie.


  • Moderator

    Tagging that for the #wiki


  • Senior Developer

    Snapins just let you run any file remotely. When you go to create / edit a snapin you will see several fields.
    A snapin gets executed in this format:

    {Snapin Run With} {Snapin Run With Arguments} {Snapin File} {Snapin Arguments}
    

    The best way to understand this is with a couple of examples.

    EXE

    Let’s say you have an exe you want to run on a computer, and you normally run it like this:

    MyFile.exe /foo /bar
    

    Then you would upload MyFile.exe, set Snapin Arguments to /foo /bar and that’s it.

    If you have an exe that is an installation (e.g. vlc), you will need to provide the silent installation parameters in the Snapin Arguments box.

    MSI

    Let’s say you want to deploy an MSI. To install an msi from the command prompt you would run

    msiexec /quiet /i MyFile.msi
    

    So to make that a snapin, upload your MSI, set Snapin Run With to msiexec and Snapin Run With Argument to /quiet /i

    Batch script

    Let’s say you want to deploy an batch script. To run a .bat / .cmd from the command prompt you would run

    MyFile.bat
    

    So to make that a snapin, upload your script, and that’s it.

    Hopefully this helps, but if you have any more questions let me know.


Log in to reply
 

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.