/build/static/layout/Breadcrumb_cap_w.png

Packaging Guide: Getting Started

Hey folks, since I've moved into a role where I do the software packaging for my company I've been putting together guides for the various programs I've done. I do this for two reasons, in case I ever need to rebuild them, and if I ever want to move up into a new role I'll need some way to train the person taking over for me. Below is some information I've compiled as general knowledge of packaging. Information as well as links that I've found useful are all layed out below. With every new package I do I add a little more to the list. As I continue to package programs and learn more I'll be updating this entry. If you have any questions please let me know! I'd be happy to try and help the best I can. As well if you have any tips and tricks of your own feel free to add them in the comments!

  1. To add programs to the Dell K1000: 
    1. Take the requested software and create a batch file to run it. If you can get it in .msi format that will be the easiest way.
      1. If you can’t get it in .msi format, you can try to package the .exe, however if that fails you’ll want to move on to AutoIT, and if that fails the last line of defense is AppDeploy Repackager.
    2. Compile the files you need and the install.bat into a zip file.
    3. In the K1000, go to Inventory -> Software and look for the program. Chances are it’s already been created since it’s been installed before. If that’s the case use that. Otherwise you may need to create a Custom Inventory rule like:
      1. FileExists(location in Program files) OR FileExists(location in Program files (x86))
  2. MSI commands
    1. MSIEXEC /I – Install command. This is done first, before the .msi file
    2. MSIFASTISTALL=1 – Uses a faster install by not checking disk space, or creating a restore point. This however may not sit well with certain 64bit Win 7 installs. If you have trouble deploying to 64bit, remove this line and see if that fixes it.
    3. /qn – “Quiet No interface” command this is a switch you’ll want to use as much as possible.
    4. /norestart – Disables restarting after an install. Important to prevent the user from losing work.
    5. RUNATONCE=”YES” – Enables the program on startup.
  3. InstallShield Commands (certain .exe’s)
    1. An easy way to check is a setup is install shield will be to run the setup.exe /? This should pop up a prompt to tell you some basic commands.
    2. /r – “Records” an install and places a file called setup.iss in C:\windows
    3. /s /f1”path to ISS file” – “Silent” uses a silent install and points to the setup.iss, without the ISS file it’s unlikely to finish. There should be no space between the /f1 and the path to the iss file. I.e. /f1C:\windows
  4. Inno Commands (certain .exe’s)
    1. /silent – Automatic install with a basic interface
    2. /verysilent – Automatic install with no interface
    3. /norestart – Disables restarting after an install. Important to prevent the user from losing work.
    4. /noicons – Disables creation of desktop icon or start menu folder.
  5. Batch Commands (.bat files)
    1. You can run any command that you normally do in Command line, meaning executables, directory listings, and others.
    2. If
      1. Exist – will search for a file, folder, location, drive, just about anything you need. Normally combined with another command. i.e. If exist <statement> <Command>
      2. Else – Allows you to add conditions to your If statement, so that if a condition is not met a different task than normal will be performed. i.e. If <statement> ( ) ELSE ( <command> )
      3. Not – Allows you to perform the opposite of a command. i.e. If NOT exist
    1. Goto – Sets the batch file to go to a label you’ve created. i.e. If exist C:  goto end (then at the bottom of the batch you’ll type :end
    2. Pause – Stops the batch file, useful for troubleshooting batch files that fail, but blink away too fast to see where. You’ll need to push a button to continue from a paused screen.
    3. Echo – Allows you to put a message on the screen for the user. However it needs to be preceded by @echo off to make it so the echo command isn’t displayed in the message, as well it should be followed by pause so that the user has time to read the message.
    4. REG query will allow you to query the registry for keys. See Links 12-8 and 12-9 for more information.
  1. Be Aware of These Problems:
    1. When deploying to 64bit, the net use command to map a drive will work during testing, but when deployed through KACE Managed installations it will result in a disconnected network drive, though you’ll have access to it. To get around this you’ll need to follow these steps
      1. Convert the code into a bat file
      2. Convert the bat file into an exe (iexpress.exe[use cmd /c <batfile>.bat at the installation command])
      3. Call the new batfile.exe with RunAsCurrentUser.exe --w <Location of batfile.exe>
    1. Not all pieces of software will behave normally in a VM, so it’s good to have physical test machine as well.
    2. Sometimes MSIFASTINSTALL batch command will cause it to not properly install on 64bit machines.
    3. Use Notepad++ to get a better look at your code than just plain notepad or word.
    4. Sometimes switches are case sensitive, meaning /s might not work for silent mode whereas /S will.
  1. Software Check Workflow for Install.bat
  2. Install.bat template:

::New Software Check

REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{<Product Key for New Software>}

IF %errorlevel%==0 goto :END

) ELSE (

if %errorlevel%==1 goto :OLDCHECK

)

 

:OLDCHECK

::OLD VERSION CHECK

REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{<REGKEY>}

if %errorlevel%==0 goto :UNINSTALL

) ELSE (

if %errorlevel%==1 goto :INSTALL

)

 

 

:UNINSTALL

::OLD VERSION UNINSTALL

MsiExec /qn /X{<REGKEY>} (Or whatever the uninstall code is)

 

 

:INSTALL

<Install Line for new Software>

 

:END

 

  1. A quick way to check for what OS version the machine running the script is using, nice if you need to do something different between 32bit and 64bit installs and you don't want to make two scripts.

set ProgFiles86Root=%ProgramFiles(x86)%

IF NOT "%ProgFiles86Root%"=="" (

     <Place whatever you want to do in 64bit here, xcopy, install, whatever>

) ELSE (

     <Place whatever you want to do in 32bit here, xcopy, install, whatever>

)

  1. Helpful links
    1. ITNinja
    2. Packaging InfoGraphic
    3. Windows Variables
    4. AppDeploy Repackager
    5. AutoIT
    6. Notepad++
    7. Xcopy Commands
    8. Registry Batch Commands
    9. Batch Error Levels/Registry Commands

Comments

This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ