How to: Make a simple snapin-Start to finish
-
Hi,
When I started I couldn’t find much information on the process. There is a lot of information but I couldn’t find any guides as such for total newbies. So now that I’ve got the hang of it I thought I’d make one for others new to FOG and Snapins. I have attached the guide as a PDF, or you can read below.I hope it is easy to understand, and believe me it gets easier very quickly the more you do.
Thanks for looking.
[CENTER][B]A newbie’s Guide to creating a FOG snapin[/B][/CENTER]
[CENTER] [/CENTER]
[B]Introduction[/B]
If you are reading this chances are you’re not sure how to make a snapin for FOG. I will give a little introduction and also the basic process of what a Snapin does. You can also skip the below if you already know this.
[B]What is a Snapin?[/B]
Ok, so a Snapin is used to deploy programs to your computers after you have imaged them. Manually installing each program can be very tedious and time consuming. There are many ways to do this, however I’ve found this way works best for the organisation I work in, however I believe it will apply to any IT department.
Once your computer is imaging, you can specify which programs you want it to have installed. An example might be:
Anti Virus, Microsoft Office, Adobe Reader, Adobe Flash.
Generally you will likely have more, this is just an example. So now that you have specified which snapins you want your Machine to have, it will start installing them automatically once logged on after imaging. So that’s the process.
[B]How does it work?[/B]
Snapins are compressed self extracting executable files. Simple right? It is once you have done it a few times!
Essentially, you get your program installation files, (exe or msi), add them into a folder (just easier to manage) write a simple .cmd script that calls the installer to start, then compress the files into a .7zip archive, then use a program to finish it. I use “7zip SFX Maker”- [url]http://sourceforge.net/projects/sfx-maker/[/url] .
You just select the 7zip archive with SFX maker and tell it to execute the cmd script once extracted. There are a few other options you can select with SFX maker but I will detail them in the walkthrough. In my example I will make an installer for Adobe Reader X (10). Ok without further ado, let’s make a Snapin![B]HOW TO MAKE A SNAPIN[/B]
[B]Step 1: What you need- basics[/B]
If you haven’t already, go download and install 7zip:
[url]http://www.7-zip.org/[/url]
Ok, now you need to download 7zip SFX Maker:
[url]http://sourceforge.net/projects/sfx-maker/[/url]
SFX Maker doesn’t “install” like a normal program, you just extract then run it. So, extract SFX Maker, then move the folder to C:\Program Files (x86) and make a shortcut to “7-ZIP SFX Maker”.
We will leave SFX Maker alone for a moment.
[B]Step 2: The installer[/B]
Ok as above in this example I’m going to make an installer for Adobe Reader 10. When finished it will automatically install Adobe Reader X and make a few Registry changes to avoid some prompts. First create a folder for your installer. Call it something descriptive:[IMG]http://i1107.photobucket.com/albums/h386/andyroo54/1.jpg[/IMG]
Download the full installer from Adobe and save it into the folder you just made:
[url]http://get.adobe.com/reader/enterprise/[/url][IMG]http://i1107.photobucket.com/albums/h386/andyroo54/2.jpg[/IMG]
[B][COLOR=red]You may want to test the install before you go any further to make sure it installs correctly. [/COLOR][/B]
[B]Step 3: Additional items[/B]
Now I’ve tested Adobe Reader installing and I’ve found I want to make a few changes to the registry after the install. These can be done by adding some registry entries and including them in the snapin. You may or may not want to do this yourself. I also changed units to Centimetres but will not include that in this example. For this example I want to:
Disable automatic updates
Disable protected mode (can cause some issues)
And automatically accept the EULA (end user license agreement)
You can export the registry settings by using Regedit after you have installed the program, and set the options manually in the program, see here:
[url]http://technet.microsoft.com/en-us/library/cc781982(WS.10).aspx[/url].
If you want to add these entries yourself just copy and paste the below into a text document, then name them with the extension example.reg and they will turn into registry entries. Only include everything under the line.
Disable updates:__________________________________________________________________
[B]Windows Registry Editor Version 5.00[/B][B][HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\10.0\FeatureLockdown][/B]
[B]“bUpdater”=dword:00000000[/B]Disable protected:_________________________________________________________________
[B]Windows Registry Editor Version 5.00[/B][B][HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\10.0\Privileged][/B]
[B]“bProtectedMode”=dword:00000000[/B]EULA:___________________________________________________________________
[B]Windows Registry Editor Version 5.00[/B][B][HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\10.0\AdobeViewer][/B]
[B]“EULAAcceptedForBrowser”=dword:00000001[/B][B]Save your registry entries into the SFX-Adobe Reader X folder:[/B]
[IMG]http://i1107.photobucket.com/albums/h386/andyroo54/3.jpg[/IMG]
[B]Step 4: The script and sleep[/B]
Now we need a script. The script is responsible for installing the program, and in this case making the registry entries also. I use .cmd scripts as they are simple to write, and once you have a good one you can just modify it for other programs. Below is the script I will us. DELTE THE RED TEXT, it only serves to explain , then Copy and paste this into a notepad document, and save it as “install.cmd” then save to the SFX Adobe folder:@ECHO OFF
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
CLS [COLOR=red](This clears the command window screen)[/COLOR]
ECHO INSTALLING ADOBE READER X DO NOT CLOSE [COLOR=red](this message will appear in a window)[/COLOR]
ECHO.
START “Adobe Reader” /wait “AdbeRdr1000_en_US.exe” /sAll /rs /msi EULA_ACCEPT=YES [COLOR=red](this calls the Adobe reader to start installing. The switches at the end help make it unattended. There are many switches)[/COLOR]
SLEEP.exe 10 [COLOR=red](this just gives the script a little time to breathe)[/COLOR]
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
CLS [COLOR=red](below are all of the registry edits as mentioned earlier) [B](( NOTE: As per the screen shot, I did originally use “REGEDIT /S” However this doesn’t work. Please use the REG IMPORT as updated below))[/B][/COLOR]
REG IMPORT Disable_protected.reg
SLEEP.exe 1
REG IMPORT Disable_updates.reg
SLEEP.exe 1
REG IMPORT Units_to_CM.reg
SLEEP.exe 1
REG IMPORT EULA.reg
ECHO INSTALLED ADOBE READER X
ECHO.
SLEEP.exe 5
EXIT [COLOR=red](ends the script)[/COLOR]
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::[B][COLOR=red]As above DON’T FORGET TO DELETE THE RED TEXT it will cause errors if you leave it in the script. [/COLOR][/B]
Now your script should look something like this when you edit it:[IMG]http://i1107.photobucket.com/albums/h386/andyroo54/4.jpg[/IMG]
You may have noticed in the script the command line “Sleep.exe” then a number. This is a little utility to give pauses to your script. You can download it here and add it to your SFX Adobe reader folder. [url]http://www.computerhope.com/dutil.htm[/url]
If you want your PC to restart after the installation you can add the following line, fog also give you that option when uploading the snapin:
shutdown -r -c “New program installed PC must now restart”
I don’t recommend this for snapins with FOG because you really want them all to install one after the other. You can manually restart it later once all Snapins have been deployed. [B]I strongly suggest that you now test the script/install, make sure that when you run the Install.cmd it properly installs Adobe Reader X and adds the registry entries.[/B] If so then you can proceed to the next step.[B][COLOR=#ff0000]IMPORTANT NOTE:[/COLOR][/B] If using Vista or Win 7 you must turn off UAC evaluation prompts for administrator otherwise windows will prompt for permission to install, and hold up your unattended process. To turn off, in your system image you shoud type secpol.msc into the start/run bar, then choose “local polices>security options>User account control:Behavior of the elevation prompt for administrators in Admin approval mode” and choose “Evaluate without prompting”. Also disable “User account control: Switch to the secure desktop when prompting for elevation”.
[B]STEP 5: Making the 7Zip archive[/B]
Ok that’s the hard part done! Now for the fun part! You should have all of your items together now in the one folder as below:[IMG]http://i1107.photobucket.com/albums/h386/andyroo54/5.jpg[/IMG]
Now select them all, then right click and choose “Add to SFX-Adobe ReaderX.7z”
[IMG]http://i1107.photobucket.com/albums/h386/andyroo54/6.jpg[/IMG]
7Zip will now compress the files into a 7Zip archive. Now we will make the SFX!
[SIZE=3][COLOR=#ff0000][B]CONTINUED IN NEXT POST[/B][/COLOR][/SIZE]
[url=“/_imported_xf_attachments/0/40_A newbies Guide to creating an SFX.pdf?:”]A newbies Guide to creating an SFX.pdf[/url]
-
CONTINUING FROM THE FIRST POST
[B]STEP 6: Making the SFX installer[/B]
Go ahead and launch SFX Maker. On the first screen it will ask you which file you want to include. This is the 7zip archive we made in the last step. So hit the plus icon and navigate to the SFX Adobe folder where archive is.[IMG]http://i1107.photobucket.com/albums/h386/andyroo54/7.jpg[/IMG]
Now move to the “General” Tab at the top. Set the extraction path to a temporary folder. Make sure you choose “hide extraction progress” and “delete the SFX file after extraction”.
[IMG]http://i1107.photobucket.com/albums/h386/andyroo54/8.jpg[/IMG]
Now move to the “Icon” tab. Here you can choose which Icon you want. You can also make your own icons and copy them to the “resources” folder in the SFX Maker directory. To make an .ico file you can use this free program:
[url]http://www.321download.com/LastFreeware/page40.html#IcoFX[/url][IMG]http://i1107.photobucket.com/albums/h386/andyroo54/9.jpg[/IMG]
Now move to the “Execute” Tab. [B]This is important[/B], this is the path to the file that we want the SFX Maker to run after it is extracted on the machine. In this case we want to use this path:
%%T\Install.cmd
This will follow the temporary path where the SFX is extracted to, and run our command to install adobe.[IMG]http://i1107.photobucket.com/albums/h386/andyroo54/10.jpg[/IMG]
Now choose “Make SFX” at the bottom right of the window. That’s it! Make sure you test the SFX thoroughly. If it works then you can upload the Snapin to FOG for deployment.[B] REMEMBER:[/B] The finished SFX will delete itself after being extracted, so make sure you make a copy somewhere or else you will have to repeat step 6.
Select “New snapin” from the snapin Menu.
[IMG]http://i1107.photobucket.com/albums/h386/andyroo54/11.jpg[/IMG]
Now you can add the details and then browse to the location, then click add! All done!
[IMG]http://i1107.photobucket.com/albums/h386/andyroo54/12.jpg[/IMG]
This guide is intended as a loose guide only for people new to FOG and snapins. This is just the way I do it and I haven’t had any problems. You can get as creative as you like with your snapins, you could for example get the .cmd script to check for older versions of Adobe reader and ask it to uninstall them before installing the new version. In this example I used an .exe for Adobe, but you can also use .msi installers, just update the script to use “msiexec” and change the quiet switches. I’ve tried to keep it straight forward and simple. The only limit is your imagination!
Another useful site is App Deploy. Lots of great information for deploying specific software.
[url]http://www.appdeploy.com/[/url]I’m still by no means an expert, but I hope this might help someone in a similar situation to what I was a few months back. Feel free to post comments I will try to answer them if I can.
Thanks and goodluck![quote=“andyroo54, post: 1271, member: 267”]Hi,
When I started I couldn’t find much information on the process. There is a lot of information but I couldn’t find any guides as such for total newbies. So now that I’ve got the hang of it I thought I’d make one for others new to FOG and Snapins. I have attached the guide as a PDF, or you can read below.I hope it is easy to understand, and believe me it gets easier very quickly the more you do.
Thanks for looking.[/quote]
-
this article looks great, I have just deployed FOG on our network and this was going to be the next stage, thanks for sharing!!
-
Good article.
-
Very well done
-
can snapins be deployed at anytime, or only after an image has taken place?r
if its the latter then all software i use is in the updated image anyway, but it would be good to deploy software mid term (without Imaging)
-
You can deploy them anytime. They are very useful, once you have made the package, you can use it to install the program on any machine that has been imaged, whenever you want. You can also use them by running them yourself on machines that haven’t been imaged. I use them all the time in this fashion. I usually only deploy snapins while imaging from FOG, usually once PC’s are out and deployed I will just run the SFX manually by running it from a server file share.
-
Thanks Andyroo54 - another great article. I’ve started building an image per your WIN7/SAD tool doc, next I’ll try the snapin method you outlined above. I don’ suppose you’ve had any luck with snapins for JAVA RTE have you?
-
This post is deleted! -
danuel please read the documentation on the fog user guide. You failed to modify apache to accept larger snapins.
[url=“http://www.fogproject.org/wiki/index.php?title=Managing_FOG#Snap-ins”]www.fogproject.org/wiki/index.php?title=Managing_FOG#Snap-ins[/url]
-
[quote=“Al@akuni, post: 2917, member: 250”]Thanks Andyroo54 - another great article. I’ve started building an image per your WIN7/SAD tool doc, next I’ll try the snapin method you outlined above. I don’ suppose you’ve had any luck with snapins for JAVA RTE have you?[/quote]
No sorry i don’t use Java. With SFX with cmd line scripting I’ve never come across an application I couldn’t install. And the way installers are going they are only going to get easier to execute silently.
-
Hi thought this might help people. If you are using both Windows 7 32 bit and 64 bit, and the installer has two versions (32 and 64) you can use this simple script to determine OS. Because only windows 7 64 bit has this directory:
“C:\Program Files (x86)”
Then the script can check this and know the machine is 64 bit. Maybe it’s not a very technical way of doing it but it works just fine. So below is a script you can use, just copy and paste it into a .cmd file.
:::::::::::::::::::::::::::::::::
@ECHO OFFif not exist “C:\Programdata” goto XP
if exist “C:\Program Files (x86)” goto METHOD2
if exist “C:\Program Files” goto METHOD1::::::::::::::::::::::::::::::::::
CLS:METHOD1
Color 1F
CLS
@ECHO 32 BIT OS DETECTED…INSTALLING BLANKSLEEP.exe 5
START BLANK.EXE
goto :FINISH32
::::::::::::::::::::::::::::::::::
:METHOD2
Color 4F
CLS@ECHO 64 BIT OS DETECTED…INSTALLING BLANK.EXE
SLEEP.exe 5
goto :FINISH64
::::::::::::::::::::::::::::::::::
:XP
Color 9F
CLS@ECHO XP OS DETECTED…INSTALLING BLANK.EXE
SLEEP.exe 5
goto :FINISHXP
::::::::::::::::::::::::::::::::::
:FINISH32
Color 1F
CLS@ECHO Installed BLANK!
SLEEP.exe 5
EXIT
::::::::::::::::::::::::::::::::::
:FINISH64
Color 9F
CLS@ECHO Installed BLANK!
SLEEP.exe 5
EXIT
::::::::::::::::::::::::::::::::::
:FINISHXP
Color 5F
CLS@ECHO Installed BLANK!
SLEEP.exe 5
EXIT
::::::::::::::::::::::::::::::::::
-
Just another example for you.
This is another simple one, being google earth.
All I want it to do is install Google earth for any user. I’ve tested this installer and luckily it works on XP/win 7x32/64.
So first I found an installer. You can download full offline installer version 6.2 here:Then you need to unzip that exe, it will then extract the ‘real’ installer file.
Now use this script and put it in the same directory as the googleearth.exe along with sleep.exe.
You can use the script below, just copy and paste it into a .cmd file.
::::::::::::::::::::::::
@ECHO OFF
Color 1A
@ECHO Installing Google EarthSLEEP.exe 5
START /wait GoogleEarth.exe /S /v/qn /V"/qn ALLUSERS=1
SLEEP.exe 5
CLS
@ECHO Google Earth Installed…SLEEP.exe 5
EXIT
::::::::::::::::::::::::You can also hide the script if you don’t want people to be able to close it, but if you are deploying the SFX from FOG, windows 7 will actually hide the script anyway.
Now follow the earlier instructions to .7z it and make an SFX!
Thanks,
-
thanks for the share, still haven’t got around to trying snapins yet but i’m with the info above this should be quite easy to get working.
START /wait GoogleEarth.exe /S /v/qn /V"/qn ALLUSERS=1
say i wanted to deploy something else is it as simple as changing googleearth.exe to the exe that i want?
-
[quote=“falko, post: 4173, member: 48”]thanks for the share, still haven’t got around to trying snapins yet but i’m with the info above this should be quite easy to get working.
START /wait GoogleEarth.exe /S /v/qn /V"/qn ALLUSERS=1
say i wanted to deploy something else is it as simple as changing googleearth.exe to the exe that i want?[/quote]
It depends on the installer. But yes most are easy.
START /Wait means the installer will start, and the cmd script will wait for the process to finish before moving on in the script.
The /S is a switch to install it silently. /Qn will make it non interactive.
So it varies, also running .msi is a little diff, you have to have msiexec instead of “START”. Read this page for more info:
[url]http://unattended.sourceforge.net/installers.php[/url]
But you will find you don’t have to change much. See this one for FileZilla, it’s basically the same as google earth:
::::::::::::::::::::::::
@ECHO OFF
Color 4F
@ECHO Installing FileZillaSLEEP.exe 5
START /wait FileZilla3.5.3.exe /S /v/qn
SLEEP.exe 5
CLS
@ECHO FileZilla Installed…SLEEP.exe 5
EXIT
::::::::::::::::::::::::But then you might want registry entries after the install, check out the original adobe reader because that contains registry entries.
I just updated Adobe reader because for some strange reason on some machines it wouldn’t printer colour…?? Anyway check out the new adobe reader script:
::::::::::::::::::::::::
@ECHO OFF
Color 4F@ECHO DO NOT CLOSE THIS WINDOW
@ECHO Installing Adobe Reader X 3.1.2…
START /wait Reader.exe /msi EULA_ACCEPT=YES /qn
SLEEP.exe 5
::::::::::::::::::::::::
CLSREGEDIT /S Disable_protected.reg
SLEEP.exe 1
REGEDIT /S Disable_updates.reg
SLEEP.exe 1
REGEDIT /S Units_to_CM.reg
SLEEP.exe 1
REGEDIT /S EULA.reg
CLS
@ECHO INSTALLED ADOBE READER X!
SLEEP.exe 5
EXIT
::::::::::::::::::::::::
If you have any problems I’ll help if I can. A good site resource is Appdeploy.com too. Just recently got renamed to: [url]http://www.itninja.com/[/url]
-
When I follow these directions and test the snap in I get a 7-ZIP SFX archive error message. In the %temp% folder of the target host a folder called 7ZipSfx.000 is created and all the files are extracted as per above. If I click on the install.cmd within this folder adobe reader installs fine, any help is appreciated.
-
AGGGG, silly error on my part. I placed all of the files into a folder and then archived the folder. Once I put all files into the archive, not a folder before hand I deploy and it installs great!
-
[quote=“Axel, post: 4576, member: 686”]AGGGG, silly error on my part. I placed all of the files into a folder and then archived the folder. Once I put all files into the archive, not a folder before hand I deploy and it installs great![/quote]
Hi Axel glad you figured it out!
-
Thanks for sharing! The stuff with 7zip and SFX maker is definitely helpful.
Another thought to add about determining whether or not a computer is running 64 or 32bit, I’ve used these lines (in batch script):
IF %processor_architecture% == x86 (for 32 bit)
IF %processor_architecture% == AMD64 (for 64 bit clients)
IF %processor_architecture% == IA64 (for 64 bit servers)I doubt many people (if any) would ever feel the need to change the Program Files environment variable, though, so I’m sure your check works great too!
-
so, what would it be for an msi file, I made a script and used start and the msi worked fine! was I just lucky? I realized that I needed to use msiexec.exe but forgot and ran the script before hand and it worked!
would I just change start to msiexec /i