Basics
Generally, an effort is always made to use the original setup routine of the respective application, rather than performing a complete re-packaging of the application. After the installation of the application, the desired settings are directly adjusted in the package.
To identify the required registry keys and files for the corresponding configurations, the Ultimate Packager from the Scripting Framework Suite is ideal. This guide demonstrates the step-by-step creation of a package using the example of the VLC Media Player (VideoLAN) application.
Packaging is typically done on a virtual client (e.g., using VMware Workstation). This allows the client to be reset to its original state at any time using snapshots. This approach is particularly useful during testing and similar tasks.
Prerequisites
Install the Scripting Framework Engine on the packaging client according to the instructions. Additionally, download "WinCM Scripting Framework Engineer x.x.x.x" from the download center and install it as an administrator via Install.cmd. This will install the PowerShell module, making the commands available, for example, in PowerShell ISE.
Procedure
To create the software package, we use a template that serves as the basis for packaging. In the download center, you will find the "Packaging Default Template" in the "Templates" category. Download it and extract it to a directory of your choice.
In the first step, we typically perform a manual installation of the application to be packaged in order to verify the required settings of the installation routine. After the installation is complete, the application is opened to check if any further settings need to be made, such as disabling automatic updates.
In this tutorial, we will create the software package for VLC Media Player. First, download the source files from the manufacturer's website. Since the package will be created for both 32-bit and 64-bit operating systems, please download both source versions.
The downloaded files are then placed in the extracted template in the Setup folder:
._Manufacturer_ProductName_Version_Language_UNV_01\Classic\Setup
The subfolder "Classic" indicates that it is a classic installation. For an App-V package, we rename the folder to "AppV" so that the type of software package is immediately recognizable. However, this folder structure is not mandatory and should be seen as a suggestion.
The silent command line switches for the software to be packaged can often be found either in the manufacturer's documentation or through an internet search engine. For VLC, the relevant information is available here on the official website. This leads to the arguments /L=1033 /S
for the setup call. In the next step, we open the file Install.ps1
with an editor and define the installation as follows:
# Close Application
SF-Taskkill "vlc.exe"
# Installation
SF-Run "%_PkgSource%\Setup\vlc-3.0.21-win64.exe" "/L=1033 /S" -Wait -x64
SF-Run "%_PkgSource%\Setup\vlc-3.0.21-win32.exe" "/L=1033 /S" -Wait -x86
SF-Taskkill is used to close VLC before installation. Then, the setup routine is called with the silent parameters. The switch -Wait ensures that the process completion is waited for, while -x64 ensures that the process is only executed on a 64-bit operating system. The SF-Run command also automatically checks the return code. The Scripting Framework variable %_PkgSource% always refers to the path where the package is located. The remaining commands in the Install.ps1, which are included as examples in the template, must be deleted.
The next step is to fill the Package.xml with the corresponding application information:
<!-- Package Definition -->
<Package>
<BuildNumber>01</BuildNumber>
<Company>UNV</Company>
<Manufacturer>VideoLAN</Manufacturer>
<ProductName>VLC media player</ProductName>
<Version>3.0.21</Version>
<VersionShort>3</VersionShort>
<Language>MUI</Language>
</Package>
The "Company" value is intended for cases where, for example, there are multiple companies or locations, and the software package is specifically intended for that, so it can be labeled accordingly. If the package is generally valid, the value "UNV" is used, which stands for "universal." At this point, the package is ready to be installed for the first time. To do this, we execute the Install.exe or run the Install.ps1 directly via PowerShell ISE. To run it directly, the Engineer module must be installed as described under prerequisites.
The installation logs are, by default, located at the path "C:\Windows_ScriptingFramework\Logs\ScriptingFramework.log". Note: The log path can also be adjusted via a registry configuration. At the bottom, after installation, the following entry should be visible:
INFO: ***** Exit VideoLAN_VLC_media_player_3021_MUI_UNV_01 with Return Code: 0 ******************************************************
Shortcuts were created on the desktop and in the Start menu, which we don't want. Therefore, we will extend the Install.ps1 script at the end to remove them:
# Remove Shortcuts
SF-Delete "%_CommonDesktop%\VLC media player.lnk"
SF-Delete "%_CommonPrograms%\VideoLAN\Release Notes.lnk"
SF-Delete "%_CommonPrograms%\VideoLAN\VideoLAN Website.lnk"
We rename the template folder from "_Manufacturer_ProductName_Version_Language_UNV_01" to the package identifier (which we can see in the log) to "VideoLAN_VLC_media_player_3021_MUI_UNV_01". The name of the folder is freely selectable, but we recommend using the package identifier as the folder name. Additionally, we delete the Config folder since we don't need it. This folder would be required in conjunction with SF-LoadVariables for dynamic software packages, but this is not covered in this guide. To test the change, we will run the package installation again and confirm that the shortcuts have been successfully removed.
Now, let's address the application settings. Upon the first start of VLC, we notice that the following window appears:
We confirm this initially, but we want to disable the automatic update. We then close VLC and launch the Ultimate Packager from the Scripting Framework Suite to trace where the setting for the automatic update is stored:
The Ultimate Packager works based on snapshots. This means: First, the initial state of all registry entries and files is recorded with "Snapshot First." Then, the desired change is made on the client, and "Snapshot Second" is created. The "Compare" function is used to compare the two snapshots. The difference between the snapshots then represents the result. You can think of it as taking two photos and overlaying them to identify the differences.
In the Ultimate Packager, you can select what should be recorded. If it involves settings that the user can change without admin rights, it is usually sufficient to select HKCU and Drive (system drive C:). By omitting the HKLM keys, the snapshot creation time is significantly reduced. With the settings as shown in the screenshot, we start with the "Snapshot First" button and wait until the "Success" message appears. Afterward, VLC Media Player is launched, and the update check is disabled in the settings:
We save the modified settings in VLC and then close the application. Afterward, the "Snapshot Second" action is started in the Ultimate Packager. Once it is created, we click on "Compare" to compare the two snapshots. Before starting the comparison, package information for the output can optionally be provided – however, we leave it as "Default" and click "OK." Once the process is complete, an Explorer window opens with the result in the form of an SF package, and the recorded files are also stored in a structured manner. This usually includes files that are not directly related to the application itself but were changed during the process (e.g., by the operating system), which can be manually cleaned up if necessary. Additional filters could also be defined in the Settings.xml of the Ultimate Packager. However, cleaning is not necessary in this case, as we will only include the relevant settings in our software package. The user settings are located in the "User" folder, where a folder named "ApplicationData" is now present, containing the VLC settings. The user registry entries can be found in the InstallUser.ps1, but the VLC Media Player does not write registry entries. In the ApplicationData folder, there is a folder named "vlc," and inside it, the vlcrc file can be found, which contains the relevant settings. We now copy the ApplicationData folder into our VLC package and delete everything in the "vlc" folder except for the vlcrc file.
.\VideoLAN_VLC_media_player_3021_MUI_UNV_01\Classic\Setup\User
In the template, two files, Disabled_InstallUser.ps1 and InstallUser.ps1, are included. If no user settings are required, the InstallUser.ps1 is deleted so that only the Disabled_InstallUser.ps1 remains, thus deactivating the user settings for the software package. In our case, however, we want to write user settings, so we delete the Disabled_InstallUser.ps1. Now, the InstallUser.ps1 needs to be edited to define that this file will be copied. It’s important to note that settings affecting the user profile should not be made in the Install.ps1. The installation is typically carried out under the SYSTEM account during software distribution, and if user-related settings were written there, they would only be stored in the SYSTEM account's user profile, not in the profile of the logged-in user! Therefore, Scripting Framework provides a simple and efficient solution with the InstallUser.ps1 to make user settings. Now, we edit the InstallUser.ps1 as follows:
#===================================================================================================
# Installation User
# ===================================================================================================
# Copy Files / Folders
SF-Copy "%_PkgCache%\User\ApplicationData" "%_ApplicationData%" -Changed
# ===================================================================================================
# END
# ===================================================================================================
We use the -Changed parameter for the SF-Copy command to ensure that the file is always overwritten. In the InstallUser.ps1 file, which was created by the Ultimate Packager, the necessary copy command for the ApplicationData folder can also be found. The installation can now be started again to test the change. The actions of the InstallUser.ps1 are written to the user log of Scripting Framework, which by default can be found here, where the result can also be verified: "%LOCALAPPDATA%\_ScriptingFramework\Logs\ScriptingFramework.log".
The Uninstall.ps1 contains the uninstallation of the application, which we will proceed with as follows and test using the Uninstall.exe:
# ===================================================================================================
# Uninstallation
# ===================================================================================================
# Close Application
SF-Taskkill "vlc.exe"
# Uninstallation
SF-Run "%_ProgramFiles32%\VideoLAN\VLC\uninstall.exe" "/S" -SkipIfNotExist -Wait -x86
SF-Run "%_ProgramFiles64%\VideoLAN\VLC\uninstall.exe" "/S" -SkipIfNotExist -Wait -x64
# Remove Files
SF-RD "%_ProgramFiles64%\VideoLAN\VLC"
SF-RD "%_ProgramFiles64%\VideoLAN" -Empty
# ===================================================================================================
# END
# ===================================================================================================
Finally, we place the application icon named Main.ico in the Icon folder, which is used, for example, by the Intune Generator: .\VideoLAN_VLC_media_player_3021_MUI_UNV_01\Icon\Main.ico. The icon can be extracted from the EXE file using an IconGrabber.
The software package is now complete and ready for use. A finished VideoLAN VLC Media Player package can also be found in our download center under the example packages.