FOG Snapins with batch files because I’m old

I like FOG

I’ve mentioned before that I really like FOG, it’s a great solution for reimaging that doesn’t have much of a price tag associated with it, aside from the hardware, and the time to learn it.

FOG uses “snapins” for application deployment.  A snapin is associated with a host machine, and then can be deployed when the machine is imaged, or redeployed when necessary.  Basic snapin configuration is fairly simple, you can upload your snapin file (typically an MSI or an executable binary) and specify flags for it, and in the case of an MSI you can specify commands to be run before the snapin (ie msiexec) with flags for that command as well.

Needing more

Sometimes, however, that is not enough; we use an application from Atlassian called HipChat for most of our internal one-on-one and group messaging needs, and quite a few of our legacy users were still using an old Adobe Air based client, which as of last week is no longer supported, and users attempting to login would receive a message notifying them of such.  I had been putting off pushing out the new native Windows client because it still has some bugs (some features don’t work if the message is pushed via API, spell check isn’t currently working, sometimes it doesn’t let you go idle and therefore the feature to send you an SMS notification if you get a message while idle didn’t work) and, most annoyingly, it installs only for the user that was running the installation, which in a corporate environment is kind of a pain in the ass.  During a one off installation it wasn’t a big deal to move some short cuts around so that all users could see, but that was an additional consideration when setting up one massive push.

A tiny bit of manual configuration for FOG

In a situation where something extra is needed, I almost always fall back on my old friend, the batch file.

I like to keep things separate, so while my batch file can live in the snapins folder just fine (/opt/fog/snapins) I like to keep the extra stuff in a new folder (ie /opt/fog/applications).  Your new folder needs to be readable via samba by all users. Anything that I call from one of the batch files lives here in applications, and in the case of something that gets updated a lot (ie HipChat, java, etc) I keep them named generic (HipChat.msi) instead of whatever the default is (HipChat.Win32.super.long.version.number.msi) so that I can drop a new version in place without having to make changes to my snapin.

Snapin configuration

For snapin configuration itself, all I do is upload the batch file, and for flags I usually put ” >c:\productname_install.log” so that I can have something to fall back on for troubleshooting, as the local FOG log isn’t very helpful and clears itself constantly.

The batch file

I wanted my batch file to uninstall the previous version, if applicable, install the new version, kill the process off (because as soon as it is installed, even in quite mode, it fires up hipchat as the user performing the installation, which in the case of a remote installation gives the user a notification that a window in the background wants their attention) and then copies shortcuts over to the all users start menu and desktop.

setlocal
:: Uninstall the old version of HipChat
wmic product where name="HipChat" call uninstall
:: Install the new version of HipChat
pushd \\10.128.2.10\applications
copy HipChat.msi c:\
msiexec /i c:\HipChat.msi /qn
:: Kill off the hipchat process
taskkill -im hipchat.exe /f
:: Copy the shortcuts over to all users
copy HipChat.lnk "c:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\"
copy HipChat.lnk c:\users\public\desktop\
:: Clean up
del c:\HipChat.msi

Conclusion

It works!  It did exactly what we needed it to do.

*Note we are still running on FOG 0.32, I have some new hardware becoming available soon and will be doing a total rebuild, which I will document here.

Comments (0)

› No comments yet.

Leave a Reply

Allowed Tags - You may use these HTML tags and attributes in your comment.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Pingbacks (0)

› No pingbacks yet.