How to: Make a simple snapin-Start to finish


  • Moderator

    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]



  • @Bigredcherokee

    Okay think I found my own fix.

    The package .exe file must contain an application manifest, i.e. an XML file with special instructions. All UAC compliant applications should have a requested execution level added to the application manifest. Requested execution levels allow the system to know the specific privileges required for a package.

    Sorry to bring up an old post.



  • Really hate to dig up an old topic but my problem is when using a exe and calling a “.bat” once its decompressed. The snapin deploys the SFX.exe just fine to the computer its post extraction that im having a problem with. I want this to be silent as possible and don’t want a user intervention. I tried a couple of things but UAC causes issues and some of the workstations are kiosk and or limited users.

    I rather use FOG to push the apps than use GPO b/c it will not slow down the boot or shutdown process.

    [code]
    @echo off

    :: BatchGotAdmin
    :-------------------------------------
    REM --> Check for permissions

    nul 2>&1 “%SYSTEMROOT%\system32\cacls.exe” “%SYSTEMROOT%\system32\config\system”

    REM --> If error flag set, we do not have admin.
    if ‘%errorlevel%’ NEQ ‘0’ (
    echo Requesting administrative privileges…
    goto UACPrompt
    ) else ( goto gotAdmin )

    :UACPrompt
    echo Set UAC = CreateObject^(“Shell.Application”^) > “%temp%\getadmin.vbs"
    set params = %*:”=""
    echo UAC.ShellExecute “cmd.exe”, “/c %~s0 %params%”, “”, “runas”, 1 >> “%temp%\getadmin.vbs”

    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
    exit /B
    

    :gotAdmin
    pushd "%CD%"
    CD /D “%~dp0”
    :--------------------------------------

    [/code]


  • Banned

    This post is deleted!


  • This post is deleted!


  • It’s also helpful to point out that when you make a switchless .exe like this it can also be used for group policy or other deployment methods =)

    I’ve recently been using sfx maker - [url]http://www.isoft-online.com/down/SFXMaker_1.3.1_Beta.zip[/url] to package and create installers for fog. Works great on larger installations of programs like Microsoft Office and Adobe CS products

    Thanks again Andyroo for the guide.


  • Moderator

    [quote=“Selfcommit, post: 10446, member: 801”]So does the fog client look specifically for an sfx, or does it just run whatever executable it’s handed as a snapin?

    Also - Does it run as the currently logged on user, or as a system account?

    When does it run? At logon?[/quote]

    I imagine it will run any exe. I haven’t tried, but I don’t know how it would distinguish one .exe from the other, so again it should work. You will just have to try it.

    If deployed from fog it will run as the administrator account you setup for fog. If you run it manually on the PC it will run with whatever privileges you have, ie it will not work if standard user, need to run as administrator.



  • So does the fog client look specifically for an sfx, or does it just run whatever executable it’s handed as a snapin?

    Also - Does it run as the currently logged on user, or as a system account?

    When does it run? At logon?


  • Moderator

    [quote=“Selfcommit, post: 10436, member: 801”]I’m looking for some better understanding on this:

    Can the snap-in tool run any executable? (Meaning could I simply write my executable in AutoIT, and then compile to exe?)

    Also what user does the file run as? Currently logged on user? System account?
    If I disable the UAC controls, will that stay disabled when the system joins a domain?
    How many times does the Snapin attempt to run?[/quote]

    Yes it can run anything. Just remember, the sfx is just a 7zip compressed archive.

    The 7zip file is made into an exe by the sfx program. All the exe does is extract the zip archive to a temporary location, then runs whatever command you specify.

    In my example, the sfx will extract the installer and the .cmd script to a temp location, then it runs the .cmd file, which then launches the installer silently. In theory, you could just tell the sfx maker to run the adobe installer, but it would not complete without input from the user which is why we use a cmd script to automate it.

    In your case, you could tell sfx maker to execute your executable that you made in AutoIT. I’d suggest trying to make a few SFX first to learn more about it.



  • I’m looking for some better understanding on this:

    Can the snap-in tool run any executable? (Meaning could I simply write my executable in AutoIT, and then compile to exe?)

    Also what user does the file run as? Currently logged on user? System account?
    If I disable the UAC controls, will that stay disabled when the system joins a domain?
    How many times does the Snapin attempt to run?


  • Moderator

    [quote=“Darrell Lanson, post: 9630, member: 1392”]With the way I have mine setup it installs in the background and doesn’t disturb the user while the snapin deploys the only thing the user might notice is the adobe reader shortcut showing up on there desktop. So once you have edited the msi file save it to a new name run sfx maker on it with the /qn silent swutches than create executable and upload that to the snaping folder. add snaping to whatever computer you want than deploy either all snapins or a single snapin under the advanced tasks.[/quote]
    Ours used to be done like this, but I found that fog actually hides it anyway if you deploy it from Fog.

    But I prefer to see it run if I’m running the SFX “manually”.



  • With the way I have mine setup it installs in the background and doesn’t disturb the user while the snapin deploys the only thing the user might notice is the adobe reader shortcut showing up on there desktop. So once you have edited the msi file save it to a new name run sfx maker on it with the /qn silent swutches than create executable and upload that to the snaping folder. add snaping to whatever computer you want than deploy either all snapins or a single snapin under the advanced tasks.



  • This post is deleted!


  • [SIZE=3][FONT=Times New Roman][COLOR=#000000] Snapin for Java, Adober Reader and Flash[/COLOR][/FONT][/SIZE]
    [SIZE=3][COLOR=#000000][FONT=Calibri]I found this way simpler for myself so I thought I would share it the first part I got from this web site [/FONT][/COLOR][/SIZE][SIZE=3][COLOR=#000000][FONT=Calibri][url]http://d4rkcell.com/archives/929[/url] I tested it with Java 7 update 9 and it works flawlessly, also Adobe Reader XI and Flash 11.5.502.110[/FONT][/COLOR][/SIZE]
    [FONT=Calibri][SIZE=3][COLOR=#000000] 1.Launch jre-****-i586.exe by double clicking it. When you see the “Welcome to Java” screen DO NOT click install. Leave the window open and open a windows explorer window.[/COLOR][/SIZE][/FONT]

    [FONT=Calibri][SIZE=3][COLOR=#000000] 2.Browse to C:\Users<USERNAME> where <USERNAME> is the username of the user you are logged in as. in my examples I will use C:\Users\usrsetup. The path you need to get to in this case will be C:\Users\usrsetup\AppData\LocalLow\Sun\Java.[/COLOR][/SIZE][/FONT]

    [FONT=Calibri][SIZE=3][COLOR=#000000] 3.You should see a folder called “jre****″ basically copy this folder to your desktop. Leave the window open.[/COLOR][/SIZE][/FONT]

    [FONT=Calibri][SIZE=3][COLOR=#000000] 4.Go back to the Java setup and close it.[/COLOR][/SIZE][/FONT]

    [FONT=Calibri][SIZE=3][COLOR=#000000] 5.Launch jre--x64.exe and check back in C:\Users\usrsetup\AppData\LocalLow\Sun\Java[/COLOR][/SIZE][/FONT]
    [FONT=Calibri][SIZE=3][COLOR=#000000] 6.You should see a folder called jre
    _x64, copy this to your desktop alongside the other folder.[/COLOR][/SIZE][/FONT]
    [FONT=Calibri][SIZE=3][COLOR=#000000]For the next part of the process we need to download something called InstEd. This is a free MSI editing program that we will use to disable the updates in the MSI files we just got and placed on the desktop. Once you have InstEd downloaded/installed browse to C:\Users\usrsetup\Desktop\jre**** (remember the username will be different for you). Follow the below instructions.[/COLOR][/SIZE][/FONT]

    [FONT=Calibri][SIZE=3][COLOR=#000000] 7.Right click jre****.msi and select “InstEd It!”. This should launch the InstEd software with the java msi loaded.[/COLOR][/SIZE][/FONT]

    [FONT=Calibri][SIZE=3][COLOR=#000000] 8.In InstEd down the left there is a pane called “Tables” scroll down this list until you see “Property” Click to highlight property. This should show some content in the main pane.[/COLOR][/SIZE][/FONT]

    [FONT=Calibri][SIZE=3][COLOR=#000000] 9.In the main pane search for AUTOUPDATECHECK and change this from a 1 to a 0. This should stop java from auto-updating when it is installed. There also appears to be a property called JAVAUPDATE, change this from a 1 to a 0 as well just to cover all bases. Finally there is a property called JU, this needs to be changed from a 1 to a 0 as well.[/COLOR][/SIZE][/FONT]

    [FONT=Calibri][SIZE=3][COLOR=#000000] 10.Once all properties have been changed you just simply click File > Save As and choose something like jre****_noupdate.msi. I usually save it in the folder jre****. This will leave you with two MSI files. Jre****.msi and jre****_noupdate.msi.[/COLOR][/SIZE][/FONT]

    [FONT=Calibri][SIZE=3][COLOR=#000000] 11.Repeat this process in C:\Users\usrsetup\Desktop\jre****_x64. The filename here for the MSI file is the same as the filename for x86 so I always rename jre****.msi to jre****_x64.msi and edit this saving it as jre****_x64_noupdate.msi[/COLOR][/SIZE][/FONT]

    [SIZE=3][COLOR=#000000][FONT=Calibri]12. Now start up SFXMaker 1.2 Final Click on the Directory Tab[/FONT][/COLOR][/SIZE]

    [SIZE=3][COLOR=#000000][FONT=Calibri]13. Directory Path is C:\Users\usrsetup\Desktop\jre**** or jre****_64[/FONT][/COLOR][/SIZE]

    [SIZE=3][COLOR=#000000][FONT=Calibri]14. File to Run is jre****_noupdate.msi or jre****_x64_noupdate.msi[/FONT][/COLOR][/SIZE]

    [SIZE=3][COLOR=#000000][FONT=Calibri]15. Silent Switches is /qn[/FONT][/COLOR][/SIZE]

    [FONT=Calibri][SIZE=3][COLOR=#000000]16. Select a SFX path and filename I usually use Java32 and Java64[/COLOR][/SIZE][/FONT]

    [SIZE=3][COLOR=#000000][FONT=Calibri]17. check off with Progress Bar and use EXEs Icon than Click on Create.[/FONT][/COLOR][/SIZE]

    [SIZE=3][COLOR=#000000][FONT=Calibri]18. With Flash (MSI files can be found here [url]http://www.adobe.com/ca/products/flashplayer/distribution3.html[/url] )the only changes to make in the MSI file if you want to stop Automatic Upadtes and agree to license are:[/FONT][/COLOR][/SIZE]

    [COLOR=#000000][FONT=Symbol][SIZE=3]·[/SIZE] [/FONT][FONT=Calibri][SIZE=3]ISCHECKFORUPDATES change 1 to 0[/SIZE][/FONT][/COLOR]

    [COLOR=#000000][FONT=Symbol][SIZE=3]·[/SIZE] [/FONT][FONT=Calibri][SIZE=3]AGREETOLICENSE change No to YES[/SIZE][/FONT][/COLOR]

    [SIZE=3][COLOR=#000000][FONT=Calibri]19. For Adobe Reader(MSI Files can be got here [url]ftp://ftp.adobe.com/pub/adobe/reader/[/url] ) edit the MSI File if you want to Agree to License EULA Accept makes it so staff dont even notice a new install and we Disable browser intergration as it locks up on one of our programs and make the following changes:[/FONT][/COLOR][/SIZE]

    [COLOR=#000000][FONT=Symbol][SIZE=3]·[/SIZE] [/FONT][FONT=Calibri][SIZE=3]AGREETOLICENSE change [/SIZE][/FONT][FONT=Calibri][SIZE=3]No to YES[/SIZE][/FONT][/COLOR]

    [COLOR=#000000][FONT=Symbol][SIZE=3]·[/SIZE] [/FONT][FONT=Calibri][SIZE=3]EULA_ACCEPT change No to YES[/SIZE][/FONT][/COLOR]

    [COLOR=#000000][FONT=Symbol][SIZE=3]·[/SIZE] [/FONT][FONT=Calibri][SIZE=3]DISABLE_BROWSER_INTERGRATION change No to YES[/SIZE][/FONT][/COLOR]

    [SIZE=3][COLOR=#000000][FONT=Calibri]20. Use SFX maker with the switch /qn and make it an executable.[/FONT][/COLOR][/SIZE]



  • [S]Maybe this is a dumb question but how do you hide the script?[/S]

    Nevermind. I think I figured it out!

    [quote=“andyroo54, post: 4164, member: 267”]Just another example for you.
    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.
    Thanks,[/quote]



  • Hmmm… So I’ve been trying to deploy/execute vbscript using 7zip SFX – and it runs perfectly (.vbs wrapped in a .7 wrapped in a .exe, set to extract to the temp folder and execute the .vbs either directly or through a .bat file that calls cscript.exe), but after it completes, Windows always complains, saying “This program may not have installed correctly.”

    Does anyone have any experience with this? So far all I’ve found is a shotgun approach of disabling the program compatibility message for [I]everything[/I] via group policy, and I’d rather not do that.



  • and, what if I want to package several .msi files in to this self executable, and have this script install them one after another, will it wait for each one to finnish, or will I have to use that sleep file.



  • 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



  • 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!


  • Moderator

    [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!


Log in to reply
 

364
Online

38982
Users

10712
Topics

101679
Posts

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