Print this article Edit this article

Packaging Tools Documentation

Documentation for the Config Manager 2012 PowerShell Wrapper and ECN Tools.

For migration instructions, see http://eng.purdue.edu/jump/b95205

Contents:


Getting Started

You will need:

The package source share is located at:

\\wppsmrtsccm01.central.purdue.lcl\softdistpkgs$\ECN\

 

pkg_source_2.PNG

 

The package source is identical in structure to our 2007 setup on Ohare.

In addition to the package directories, note Open_Tools.cmd. This is the entry point to all of the tools listed in this section, and should be launched each time you need to do work inside the package source.

Double-click or otherwise launch Open_Tools

Click Run at the Security Warning. This occurs because we are running from a network path.

warning.PNG

You are now at a PowerShell command prompt. You do not need PowerShell experience to use the tools. In this prompt window, you can always use any of the commands that you see in the Menu. Type Menu if you forget which commands are available.

menu_2.PNG

 

Creating a New Package

Let's get started by creating a package for NotePad++.

Your PowerShell prompt is at the package source root. Type:


newpkg.PNG

(If you prefer to leave off the parameters, you'll be prompted for them)

New-Package will:

  • Create any necessary directories
  • Clone a copy of the latest Toolkit into the package directory, ready for setup.

This is what the Toolkit looks like:

toolkit.PNG

Unlike the standard PSAppDeployToolkit release, creation or modification of PowerShell scripts is not required.

Any vendor source files (e.g. EXEs, MSIs) must be placed in the Product folder. Do not remove the hidden .gitignore file.

Your scripts must go in the Files directory.

files.PNG

Files is pre-populated with install.cmd, install_user_context, remove.cmd, and Settings.xml. You can rename the scripts however you like. 

cd into your new package directory to run further commands:

cd_2.PNG

Settings.xml

Settings.xml is the critical file where all information about the package will be placed. This is the only place you need to enter this information. Send-To-CM function uses this for component creation, and the Toolkit uses these settings when installing your program.

While inside the package directory, run the Verify any point to check if Settings.xml has all the information it needs. Other functions will run Verify automatically.

verify.PNG

The Settings.xml file:

settings_cap.PNG

 


<Install                               :Program name. Auto-generated by New-Program

Status = "Build" :"Build", "QC", "Testing", "Active", etc...

Script = "install.cmd" :This script will be run when the program runs


Requires_User_Setup = "False" :Equivalent to "Needs login script support"

User_Setup_Script = "" :This script will be run in the user's context at login

User_Files = "" :Payload to go along with setup script. Can be file or directory.

Always_Rerun = "False" :False = Runs once per user per machine. True = runs every time the user logs in.

Bitness = "64" :64 = Runs from 64 bit cmd. 32 = Runs from 32 bit cmd


No_User_Logged_On = "False" :Sets No User Logged On in CM

Interactive = "True" :Show PSAppDeployToolkit notifications.
:Allows user to defer installation twice if logged in.

          Architecture = "64"          :32 or 64. Script will run in this type of CMD.exe
     Ignore_Exit_Codes = "3010,1641"   :These are logged as Successful

                         Close_Apps = " "                             :User must close these apps before login can begin, :and they will be blocked from launching while installing :Specify process name without extension, comma separated. :(e.g. "iexplore,WINDWORD") Estimated_Disk_Space = "20" :Sets CM disk space Maximum_Run_Time = "15" :Sets CM timeout Comment = "" :Sets CM description field. /> If you need another program, you can copy and paste a program section, or run New-Program and a new section will be added to Settings.xml automatically.

.cmd Scripts

If you are converting a current package to SMARTcomputing, environment variables must be updated.

The template provided by New-Package and New-Program:

 


cmd.PNG

::

@echo Environment Expansion:

@echo ProgramAction = %ProgramAction% : Install

@echo PackageName = %PackageName% : NotePad++

@echo PackageVersion = %PackageVersion% : 6.7.5

@echo MyDir = %MyDir% : Z:\\...\NotePad++\6.7.5\Files Use to reference additional scripts

@echo ProductDir = %ProductDir% : Z:\\...\NotePad++\6.7.5\Product
Use to reference all vendor-provided files

@echo LogDir = %LogDir% : C:\SMARTcomputing\Logs\NotePad++_6.7.5 Use for extra logs

@echo LogStub = %LogStub% : C:\SMARTcomputing\Logs\NotePad++_6.7.5\NotePad++_6.7.5_Install_
Use for native logs, like %LogStub%MSI.log

@echo StartMenu = %StartMenu% : C:\ProgramData\Microsoft\Windows\Start Menu
Append Programs directory for most products: %StartMenu%\Programs\
@echo Desktop = %Desktop% : C:\Users\Public\Desktop


set prompt=$T%G : Shows time for each command line

:: Do not modify section above

:: Perform installation here


:: Do not modify section below
exit %exitcode%

User Context Scripts (Active Setup)

The wrapper now configures Microsoft's Active Setup entries for packages. 

If your program needs to configure things in the user's context (e.g. HKCU entries, preference files in their profile), then use a user context script. This is similar to "Requires Login Support" in our SCCM 4.0 setup. 

To enable this, set Requires_User_Setup = "True", and User_Setup_Script in Settings.xml. If you have a payload of files that User_Setup_Script needs to reference, put the name of the payload in "User_Files". This can be a single file or a directory of files.

The script you specify in User_Setup_Script does not have any environment variables or requirements.

Let's look at an example:

VLC 2.2.0 requires some files to be copied to the user's %appdata% folder to turn off an update check. We'll call the script "install_updates_off.cmd", and put the files we need inside a directory name "user". This directory must be in the Files directory.

user.PNG

userscript.PNG

Tell Settings.xml about the files we need:

req_user_setup_4.PNG

The files will be copied to C:\Users\Public\ECN.

The Package's directory inside C:\Users\Public\ECN will be removed when the Remove program is run. Reinstalling will put down a fresh copy.

There will be a directory for each package that is installed on the computer. We can see that inside VLC_2.2.0, our files were copied:

userfiles.PNG

The script will run once per user at login. We can see here that for a test account, our files were copied:

vlcfiles.PNG

 

Adding Package to Configuration Manager

  1. cd from the Tools prompt into your Package's directory.
  2. Type Send-To-CM. If your Settings.xml file is not complete, errors will listed here.
  3. You will be prompted, once for each program, whether or not you want to create a matching Collection and Deployment. Under our current standards, we only create a Collection and Deployment for Install programs.

send-cm-prompts.PNG

 

cm_2.PNG

 

 

Adding a Program to a Package

Packages sometimes need more than just install and remove, which is why we use a heavily modified version of the PSAppDeployToolkit that enables multiple program. If you need another program (UpdateLicense, Add_Drivers, Fix, etc...), run New-Program from inside the package source. You'll get a new script template and Settings.xml will be populated with a new area.

You can re-run Send-To-CM at any time, and new programs will be added to your existing package.

At this time, only programs named "Install" will be given a collection and deployment (advertisement).

newprogram.PNG

Updating Distribution Points

This is not currently functioning. Working on. For now, you should manually update the DPs in Config Manager.
 
 

Testing

To test a package without CM:

  1. Make sure your program passes the Verify command
  2. Open a PowerShell prompt with Run as administrator
  3. Map the package source with Net Use
  4. cd to your package directory
  5. Run your program with .\Deploy-Application.exe -DeploymentType "ProgramName"

(Add -DeployMode "Silent" to simulate Interaction = "False")

(Add /32 to simulate run with 32-bit cmd)

testrun.PNG

Your program will be launched after a few seconds.

install_welcome.PNG

installing.PNG

install_done.PNG

bubble.PNG

 

Logging

Logs are currently being written to ECNWinMgt (Tables SC1_Logs and SC1_LogData) on Pine until we have service credentials for other servers.

On the local machine, logs for each package have their own directory:

C:\SMARTcomputing\Logs\PackageName_PackageVersion\

Logs look like this:

logsm.PNG

 

If an installation fails, logs are uploaded to the database. This allows for package diagnosis on machines that may have become inaccessible.

To view all logs for a machine, use the Show-Logs command in Open_Tools.cmd.

show-logs.PNG

You'll see all success and failure logs for that machine.

loggrid.PNG

You can download a copy of these logs in a CSV format.

exportcmd.PNG

csv.PNG

 

To download logs, find the LogID for the log you want to see. It must be a Failed event.

get.PNG

You now have a copy of the log on your local machine.

locallog.PNG

Last Modified: Dec 19, 2016 11:12 am US/Eastern
Created: Mar 17, 2015 12:57 pm GMT-4 by admin
JumpURL: