Common Conditions
Common Conditions
The following conditions are available in the "Common" tab of the dialog for the If command to create the expression:
- Compare Strings
Checks if a package variable or an environment variable has the specified value. - CheckInstallMode / Test-InstallMode (check for installation or execution mode)
Checks the mode the current installation is executed with.
The following modes are available: - user portion
- computer portion
- repair
- reinstallation
- modification
- update
- uninstallation
Due to compatibility with older scripts, a check for reinstallation will also return "true" if the actual execution mode is modification or update. In a script with more than one CheckInstallMode, make sure to check for modification or update before checking for reinstallation.
- CheckPlatform / Test-Platform (check OS version)
Checks if the operating system and the type of computer correspond to the specified value. - Get-InstalledApplicationProperty
Retrieves a property for an installed application and compares it with a value. - IsCurrentUserLocalAdmin / Test-LocalAdmin
Checks whether the current user has local administrative permissions. - IsInstalled / Test-PackageInstalled (executed installation of a package)
Checks if the selected package has been executed already. The check is performed by checking the logging of the package in the registry of the target system using the package-specific GUID. - IsLaptop / Test-Laptop (Computer defined as laptop)
Checks whether the current computer is a mobile device. This is done by checking the ChassisType property of the Win32_SystemEnclosure WMI class. If it has one of the values 8, 9, 10, 11, 14, 18 or 21, the condition is true. (vgl. https://www.powershellgallery.com/packages/Test-WMiSMUGIsLaptop). - IsOnBattery / Test-OnBattery
Checks if the system is currently connected to the power supply or running on battery. - IsRebootPending / Test-PendingReboot
Checks whether a reboot is pending for the computer (see also https://adamtheautomator.com/pending-reboot-registry-windows/). - IsRemoteLoginDisabled / Test-RemoteLoginDisabled
Checks whether remote login for users via RDP is currently allowed (is equivalent to the result of the change logon /query command) - IsRunningOnServerOS / Test-RunningOnServerOS (computer with server OS)
Checks, if a server OS is running on the computer. - IsRunningOnX64 / Test-RunningOnX64 (computer with 64bit OS)
Checks, if a 64bit OS is running on the computer. - IsSwPackageRevInstalled / Test-PackageRevisionInstalled (executed installation of a package)
Checks if the selected package has been executed already. You can define a specific revision. The check is performed by checking the logging of the package in the registry of the target system using the package-specific GUID. - IsVirtualMachine / Test-VirtualMachine
Checks whether the current workstation is a virtual machine or a physical device. - LineExists / Test-Line (existence of a line)
Checks whether a specific line exists in the specified file. Wildcards can be used also. Moreover, it can be selected whether on 64-bit computers the 32-bit branch of the system folder should be used or not. - ProductVersion / Get-ProductVersion (product version)
Checks the product version of the specified file.
When creating the condition you can select the file you want to check in the Product Version dialog. Packaging PowerBench automatically enters the correctly formatted product version number of the selected file.
You can also enter the product version number manually or use a variable. Note when entering the version number manually: The specified version value needs to be specified in correctly formatted way e.g. 1.0.0.0 or 4.3.1.