Introduction

ProfileUnity has an option to convert MSI or executable installers to FlexApp packages in batch. This blog article is about batch conversions.

In this example, the Office add-on Grammerly and Notepad++ 8.2 are converted in batch.  Also, in Notepad++ the automatic update option is removed.

Background information

There are 2 components:

    1. Packaging Capture Agent
      Is installed on each computer where the installation is captured. The Capture Agent can be installed on multiple computers, you are not limited to just one. 

    2. Primary Packaging Manager
      Is installed on a dedicated computer or server. From the Primary Packaging Manager, the packages are created and are the capture agents monitored.
      In this example, the Primary Packaging Manager is installed on the domain controller. Not recommended, but it suits my situation. 

The architecture of Capture Agents and Primary Agents. (C) LiquidWare

 

 

Installation commands

The installation commands for Grammarly and Notepad++ should be clear. Of course, the installations should be silent. There is no option to interact with the installation. For Grammarly, the silent installation command is GrammarlyAddInSetup.exe /fastforallmode /silent. Notepad++ can be installed silently with the command npp.8.2.Installer.x64.exe /S. But... to remove the automatic update file a modified config.model.xml must be placed in %ProgramFiles%\Notepad++. Also, the folder %ProgramFiles%\Notepad++\updater must be deleted.

To achieve this, I created an install.cmd:

"\\demo-sccm\ProfileUnityFlexApps\NotepadPlusPlus_8.2_ENG_1.0.0\4.Sources\npp.8.2.Installer.x64.exe" /S
copy "\\demo-sccm\ProfileUnityFlexApps\NotepadPlusPlus_8.2_ENG_1.0.0\4.Sources\config.model.xml" "%ProgramFiles%\Notepad++" /y
del "%ProgramFiles%\Notepad++\updater" /s /q

During the installation phase, only the installation command install.cmd is copied locally to the agent. Therefore, it is mandatory to run all the commands from the original location. 

Preparation

Installation of the Packaging Capture Agent

The latest version can be found under FlexApp Packaging Automation software of the Liquidware Documentation. I placed the executable on a dedicated share.

The installation command is: fpa-installer_1.0.25.7900.exe install agent /AgentUsername "fpa_services" /AgentPassword "WhateverPasswordYouLike" /AcceptEULA

Result installation of the Packaging Capture Agent.

Installation of the Primary Packaging Manager

In this scenario, all the commands are run from my domain controller. In this example, this is my Primary Packaging Manager.

The installation command is fpa-installer_1.0.25.7900.exe install primary /PrimaryUsername "fpa_services" /PrimaryPassword "WhateverPasswordYouLike" /AcceptEULA

Installation Primary Packaging Manager.

Linking the Packaging Capture Agent and the Primary Packaging Manager

In order to start packaging jobs on the computer running the Packaging Capture Agent, the Packaging Capture Agent and Primary Packaging Manager should be linked. Also, the connection should be verified.

Open an elevated command prompt and go to the folder C:\Program Files (x86)\Liquidware Labs\FlexApp Packaging Automation. Give the command primary-client.exe add agent /PrimaryUsername "fpa_services" /PrimaryPassword "WhateverPasswordYouLike" /AgentAddress https://windows10wkg_02:9074 /AgentUsername "fpa_services" /AgentPassword "WhateverPasswordYouLike"

Link PCA and PPM.

And check the connectivity with the command primary-client.exe list agent /PrimaryUsername "fpa_services" /PrimaryPassword "WhateverPasswordYouLike"

Check connectivity between PCA and PPM.

Create the installation file

In this example, the installation of both Grammarly and Notepad++ are captured on one PC. To avoid conflicts, a system resource point is created before each installation and applied after each installation. Only dependencies should be installed first. Grammarly uses Office, so Office should be installed first. 

For Notepad++: primary-client.exe Add PackagesFile /PackagesFile "%USERPROFILE%\Desktop\PPM\BatchConversion.json" /Name "NotepadPlusPlus_8.2_ENG_1.0.0" /Path "\\demo-sccm\ProfileUnityFlexApps\NotepadPlusPlus_8.2_ENG_1.0.0\3.Production" /Installer "\\demo-sccm\ProfileUnityFlexApps\NotepadPlusPlus_8.2_ENG_1.0.0\4.Sources\install.cmd"

Result installation file Notepad++

The result.

For Grammarly: primary-client.exe Add PackagesFile /PackagesFile "%USERPROFILE%\Desktop\PPM\BatchConversion.json" /Name "Grammerly_6.8.263_ENG_1.0.0" /Path "\\demo-sccm\ProfileUnityFlexApps\Grammerly_6.8.263_ENG_1.0.0\3.Production" /Installer "\\demo-sccm\ProfileUnityFlexApps\Grammerly_6.8.263_ENG_1.0.0\4.Source\GrammarlyAddInSetup.exe" /InstallerArgs "/fastforallmode /silent"

Grammarly

Create the password file

All the login details are stored (in hash) in a defaults.json file. So you can share this file with other admins without giving them any login information. This file has to created once and recreated any time if something has been changed. 

The command is: primary-client.exe Create DefaultsJSON /DefaultsJSON "%USERPROFILE%\Desktop\PPM\defaults.json" /PrimaryUserName "fpa_services" /PrimaryPassword "WhateverPasswordYouLike" /PathUserName "demo\packager" /PathPassword "S0omeOtherP@ssword" /PuAddress https://demo-sccm.demo.local:8000 /PuUsername "demo\packager" /PuPassword "S0omeOtherP@ssword"

Creating the password file.

The result.

Creating the packages

The command is: primary-client.exe Create Packages /PackagesFile "%USERPROFILE%\Desktop\PPM\BatchConversion.json" /DefaultsJSON "%USERPROFILE%\Desktop\PPM\defaults.json" /WaitForDone

Creating packages.

The result.

You can find all the logfiles in %LOCALAPPDATA%\Temp\Fpa on the computer acting as the Primary Packaging Manager. If there is an error, check the files corresponding with the package name for more details.

Some examples:

(1)

10:02:22.472 [1] Fatal - fatal error : System.Exception: WINDOWS10WKG_02 - Index and length must refer to a location within the string. (Parameter 'length')
 ---> System.ArgumentOutOfRangeException: Index and length must refer to a location within the string. (Parameter 'length')
   at System.String.Substring(Int32 startIndex, Int32 length)
   at package_create.PackageCreate.BuildVolumeLabel(String displayName, String fileName)
   at package_create.PackageCreate.Create(PackageCreateArgs args, PackageXml& packageXml)
   --- End of inner exception stack trace ---
   at package_create.PackageCreate.Create(PackageCreateArgs args, PackageXml& packageXml)
   at package_create.Program.RunCommand(Arguments arguments)
   at lw.system.console_app.Program.Main[TArgs,TProgram](String[] args, Func`2 getHelp, Func`2 getLogLevel, Func`2 getLogPath, Func`2 getCommand, Action`1 printHelp, Func`2 runCommand, Func`2 parse)
Unhandled exception. System.Exception: WINDOWS10WKG_02 - Index and length must refer to a location within the string. (Parameter 'length')
 ---> System.ArgumentOutOfRangeException: Index and length must refer to a location within the string. (Parameter 'length')
   at System.String.Substring(Int32 startIndex, Int32 length)
   at package_create.PackageCreate.BuildVolumeLabel(String displayName, String fileName)
   at package_create.PackageCreate.Create(PackageCreateArgs args, PackageXml& packageXml)
   --- End of inner exception stack trace ---
   at package_create.PackageCreate.Create(PackageCreateArgs args, PackageXml& packageXml)
   at package_create.Program.RunCommand(Arguments arguments)
   at lw.system.console_app.Program.Main[TArgs,TProgram](String[] args, Func`2 getHelp, Func`2 getLogLevel, Func`2 getLogPath, Func`2 getCommand, Action`1 printHelp, Func`2 runCommand, Func`2 parse)
   at package_create.Program.Main(String[] args)

WINDOWS10WKG_02 - Index and length must refer to a location within the string. (Parameter 'length')

This means that the folder name where the package is stored is too long. Shorten the location or change the name.

(2)

15:45:43.175 [1] Info - package_create.Internal.Installer.AdjustArgs
15:45:43.175 [1] Debug -    file                   : \\demo-sccm\ProfileUnityFlexApps\NotepadPlusPlus_8.2_ENG_1.0.0\4.Sources\install.cmd
15:45:43.175 [1] Debug -    args                   : 
15:45:43.175 [1] Debug -    dontCopyInstallerLocal : False
15:45:43.175 [1] Debug -    installerTempPath      : C:\WINDOWS\TEMP\FpaInstaller
15:45:43.175 [1] Debug -    remoteInstaller        : ???
15:45:43.175 [1] Debug -    localInstaller         : ???
15:45:43.175 [1] Debug -    newFile                : ???
15:45:43.175 [1] Debug -    newArgs                : ???
15:45:43.175 [1] Debug -    remoteInstaller : \\demo-sccm\ProfileUnityFlexApps\NotepadPlusPlus_8.2_ENG_1.0.0\4.Sources\install.cmd
15:45:43.175 [1] Debug -    localInstaller  : C:\WINDOWS\TEMP\FpaInstaller\install.cmd
15:45:43.175 [1] Debug -    newFile         : C:\WINDOWS\TEMP\FpaInstaller\install.cmd
15:45:43.175 [1] Debug -    newArgs         : 
15:45:43.175 [1] Debug -    copying remoteInstaller to localInstaller
15:45:43.200 [1] Debug -    done copying remoteInstaller to localInstaller
15:45:43.201 [4] Debug -    running installer...
15:45:43.378 [5] Debug - 
15:45:43.378 [5] Debug - C:\WINDOWS\system32>"C:\Windows\Temp\FpaInstaller\npp.8.2.Installer.x64.exe" /S 
15:45:43.380 [6] Debug - '"C:\Windows\Temp\FpaInstaller\npp.8.2.Installer.x64.exe"' is not recognized as an internal or external command,
15:45:43.381 [6] Debug - operable program or batch file.
15:45:43.382 [5] Debug - 
15:45:43.382 [5] Debug - C:\WINDOWS\system32>copy "C:\Windows\Temp\FpaInstaller\config.model.xml" "C:\Program Files\Notepad++" /y 
15:45:43.385 [5] Debug - The system cannot find the file specified.
15:45:43.389 [5] Debug - 
15:45:43.389 [5] Debug - C:\WINDOWS\system32>del "C:\Program Files\Notepad++\updater" /s /q 
15:45:43.390 [6] Debug - The system cannot find the file specified.
15:45:43.393 [5] Debug - 
15:45:43.393 [6] Debug - 
15:45:43.394 [4] Debug -    done running installer, installerExitCode : 1

Only the installation executable is copied locally. All the other files in the 'Sources' folder are ignored and not copied. So, if using a cmd file use the folder names instead of %~dp0.

Adding the applications to the ProfileUnity Configuration Management

Notepad++

Notepad++ 8.2

 Grammarly

And Grammarly.

Testing on the client

And now, testing on the client. 

Grammarly has been enabled in Word.

Grammarly has been enabled in Word.

Notepad++ in the Start Menu.

Notepad++ is found in the Start Menu.

No automatic updates.

And no Automatic Software Updates. 

Please, leave a comment if you have any questions. 

Other articles in this series: