Core Extension
Core Extension
Ensure Core Extension in RealmJoin portal
To ensure the extensions are correctly deployed on all clients, please add the core extensions Chocolatey package to the back-end with order 1 and assign it to the global core group.
Enable extension CmdLets in Craft packages
Out of Chocolatey packages, the usage of the extension CmdLets has to be enabled:
Useable RealmJoin variables
Chocolatey variables
$packagePrefix = flavour prefix of this package
$packageName = name of this package
$packageVersion = version of this package
$packageVersionObject = [System.Version]$env:packageVersion
$packageVersionNoRevisionObject = New-Object System.Version -ArgumentList $packageVersionObject.Major, $packageVersionObject.Minor, $packageVersionObject.Build
$packageParameters = parameters as specified in the assignment arguments
$packageFolder = folder in which the package is extracted
$packageToolsFolder = sub directory "tools" of a Chocolatey package, contains the install script. Defined as: Join-Path $env:packageFolder "tools"
$packageTempDir = temp directory which is used for the package. Defined as: Join-Path $env:TEMP (Join-Path $env:chocolateyPackageName $env:chocolateyPackageVersion)
$PackageID = unique ID of the package
Environment variables
$env:RJ_Version
$env:RJ_UserSID = SID of the user who started this package installation. Can be used in system crafts if parameters are initialized
$env:RJ_ChocolateyPackage = glueckkanja-test-choco
$env:RJ_InstalledVersion = 1.0.0.1
$envRJ_PackageID = glueckkanja-test-choco
$env:RJ_DeploymentPhase = contains information on the installation. Can be:
Important
In order to keep the following sections easy to read und clear, a lot of extensions are based only on Chocolatey. Of course these extensions are also usable for Craft. Therefore you have to remove 'Chocolatey' from an extension to make it valid for 'Craft'.
For example:
Chocolatey extension =Get-ChocolateyRealmjoinLocaleId
Craft extension =Get-RealmjoinLocaleId
AppV Packages
Enable-ChocolateyRealmjoinAppv
This command will enable AppV on current client with BranchCache as supported.
Syntax
Install-ChocolateyRealmjoinAppvPackage
This command will add and publish an AppV package
Syntax
Parameters
Uninstall-ChocolateyRealmjoinAppvPackage
This command stops and removes an AppV Package.
If needed a used connection group will also be stopped upfront.
Syntax
Parameters
Get-ChocolateyRealmjoinAppvPackageVfsPath
Syntax
Parameters
Install-ChocolateyRealmjoinAppvConnectionGroup
This command adds and enables a connection group by a xml-based definition given as its filename
Syntax
Parameters
Uninstall-ChocolateyRealmjoinAppvConnectionGroup
This command removes a connection group for AppV packages
Syntax
Parameters
Logs and Transforms
Get-ChocolateyRealmjoinLocaleId
Returns the corresponding LocaleID of a given locale string (e. g. en-US or de-De)
If the translation fails, the default localeID 1033 (en-US) is returned. Can be overwritten with a custom default value.
Syntax
Parameters
Get-ChocolateyRealmjoinLocaleMsiTransform
Based on the given LocaleID this command will return the path of the localized transform file.
By default the file is supposed to be located in package root folder. A parent folder for localed file can provided as a parameter (localeTransformsFolder).
The root folder for any file reference inside the scripts are always tools.
For using locale string (e. g. de-de) as input the command be combinded output from Get-ChocolateyRealmjoinLocaleId.
Syntax
Parameters
Get-ChocolateyRealmjoinLogFilePath
This command will return the realmjoin-specific logfile path including a package-specific logfile depending on the execution context.
Syntax
Parameters
Chocolatey Packages
Install-ChocolateyRealmjoinPackage
This command will install a software (installer file from cloud blob storage).
Syntax
Parameters
Uninstall-ChocolateyRealmjoinPackage
This command uninstalls a software package.
By default MSI based installer is performed with the most common silent parameters. The valid exitcodes for success are set to 0, 1641, 3010 for MSI and EXE based installer.
Optionally args for a silent uninstallation, valid exitcodes for success and post-installation actions as a PowerShell scriptblock
(e. g. deleting a desktop shortcut) can be provided.
The parameter additionalArgs is populated with args from the given uninstall info (object) and can not be overwritten. Use silentsArgs to apply additional parameter(s) for a silent uninstallation.
If parameters from uninstall info (object) are not suitable for a successful (silent) uninstallation, you can provide the uninstall info manually as parameters. You have to provide a uninstaller executable file (uninstallerFile), uninstall args (additionalArgs) and a package name (subPackageName) for product to be uninstalled.
Syntax
Parameters
Import-ChocolateyRealmjoinPackageParameters
Retrieves the package parameter given provided by the RealmJoin Portal (package or user assignment). Those parameters will become available inside the scripting as prefixed variable (packParam). A parameter like /Language:de-de will be provided as the variable $packParamLanguage with the string value of de-de.
Syntax
Parameters
Test-ChocolateyRealmjoinRegistryUninstallExists
With this command you can test if a software exist on your system. This test based on the uninstall info from Get-ChocolateyRealmjoinRegistryUninstallInfo.
Syntax
Parameters
Get-ChocolateyRealmjoinRegistryUninstallInfo
With this command you can get the common uninstall infos as PSObject of all items.
Syntax
Parameters
Get-ChocolateyRealmjoinRegistryUninstallStrings
With this command you will get an object with key name, file and arguments of an uninstall info match. You will get this info from Get-ChocolateyRealmjoinRegistryUninstallInfo.
Syntax
Parameters
Get-ChocolateyRealmjoinWebFile
Downloads given filename (archive) from cloud blob storage.
Syntax
Parameters
Invoke-RealmjoinChocoPackageInstallation
Syntax
Parameters
Command line
Join-RealmjoinCommandLine
Syntax
Parameters
Split-RealmjoinCommandLine
Syntax
Parameters
Get-RealmjoinCommandLineWithLauncher
Syntax
Parameters
Restart-RealmjoinComputer
A system restart can be initiated. By default with a delay of 10 seconds, which can be overwritten by the corresponding parameter. Optional you can provide a message by parameter. Behind the scene, a scheduled task is created which performs a shutdown with a parameter for restart.
Syntax
Parameters
Get-RealmjoinComputerSystemBiosVersion
Syntax
Get-RealmjoinComputerSystemModel
Syntax
Parameters
Custom States
Out-RealmjoinCustomState
This command creates a custom state with a mandatory name and input object.
Syntax
Parameters
Remove-RealmjoinCustomState
This command removes a custom state
Syntax
Parameters
Scheduled Tasks
Using predefined RealmJoin cmdlets, it is possible to register scheduled tasks in system or user scope. The cmdlet provides an XML template, that is modified following the used parameters. Tasks also might be unscheduled.
Register-RealmjoinCustomStateScheduledTask
This command registers a scheduled task with package title a its name for creation. By default with a repetition interval of one day and a mandatory PowerShell script (publishState.ps1) in the current script dir.
Optionally the parameters PublishStateScriptFile can be overwritten.
Syntax
Parameters
Unregister-RealmjoinCustomStateScheduledTask
This command removes the custom state scheduled task by its name - typically the package title.
Syntax
Parameters
Get-RealmjoinInvocationParameters
Syntax
Parameters
Get-RealmjoinPathRooted
Syntax
Parameters
New-RealmjoinScheduledTaskBootTrigger
This command will create a boot scheduled task trigger
Syntax
Parameters
New-RealmjoinScheduledTaskDailyTrigger
This command will create a daily scheduled task trigger
Syntax
Parameters
New-RealmjoinScheduledTaskLogonTrigger
This command will create a logon scheduled task trigger.
Syntax
Parameters
New-RealmjoinScheduledTaskTimeTrigger
This command will create a custom scheduled task trigger.
Syntax
Parameters
New-RealmjoinScheduledTaskXml
This command creates (and optionally registers) a scheduled task with a given action and trigger, e. g. loggon trigger.
By default its only returns the XML content for a scheduled task, enabled with user
as principal and a execution time limit of 15 minutes. To optionally register the task the parameter Register and a mandatory task name (TaskName) must be provided.
Optional switch
parameters to start the task once after creation (StartOnce) or for deleting the task after its first run (DeleteAfterFirstRun) can be set.
Syntax
Parameters
Shortcuts
The following cmdlets allow to remove, create or modify shortcuts ot/on the desktop or the global start menu.
New-RealmjoinShortcut
This command will create shortcuts. If you do so, this shortcut will follow a defined TargetPath and a defined shortcutPath
Syntax
Parameters
Remove-RealmjoinShortcut
This command will remove shortcuts
Syntax
Parameters
Format-RealmjoinShortcutPath
Syntax
Parameters
Start-RealmjoinSoftwarePackageInstallation
Syntax
Parameters
Add-RealmjoinExeToTaskbar
This command attaches a given path to the Windows taskbar.
Only the extension types .exe
and .lnk
are supported.
Syntax
Parameters
Fonts
tbd
Add-RealmjoinFont
This command adds and registers a font to the system by a given path to the font file.
Syntax
Parameters
Remove-RealmjoinFont
This command removes a font from the system.
If you only know the file path, you can provide the mandatory name by using the PowerShell pipeline with the output of command Get-RealmjoinFontName.
Syntax
Parameters
Get-RealmjoinFontName
This command returns the font name of a given font file.
The output can typically used to remove a font without knowing the font name and using the command Remove-RealmjoinFont.
Syntax
Parameters
Registry
tbd
Get-RealmjoinRegistryValue
Returns the value of one or more registry entries. Will return $null (or hashtable with entries set to $null) of the registry key or any entries are missing, but will not fail. If only one registry entry is requested, its value will be returned directly. If more than one registry entry is requested, a hashtable will be returned.
Syntax
Parameters
Update-RealmjoinRegistryValue
This command sets a registry to a specific value or removes the entry (if value is $null). It will also create the registry key of it does not exist.
Syntax
Parameters
INI Files
tbd
Get-RealmjoinIniFileValue
This command returns the value of an entry in the given section of the specific ini-file.
Optionally a default value will be return, if key name is not found, can be provided.
Syntax
Parameters
Update-RealmjoinIniFileValue
This command sets a given value of an entry in the given section of the specific ini-file.
Any existing value will be overwritten.
Providing
$null
for section, key name or value will be removes itself from the file.
Syntax
Parameters
Logging
tbd
Copy-RealmjoinExternalLogFiles
This command copies product-specific logfiles from a given location to the common RealmJoin-specific location. By default every file with a last write time greater or equal then 5 seconds before script start will be collected.
Optionally a filename filter (e.g. *.log), in- or exluding filename(s) can be provided. Optional switch
parameters for deletion after copy (DeleteAfterCopy), creation time prefixing (PrefixWithCreationTime) and a recursivley copy including subfolders (Recurse) can be set.
The parameter NotBefore can be overwritten with a custom value of type[DateTime]
. Alternatively for more specific filtering with a powershell scriptblock
, used as a criteria for Where-Object, can be given.
Syntax
Parameters
Get-ChocolateyRealmjoinLogFilePath
This command returns a RealmJoin-specific log file path including a package-specific log file depending on the script execution context. Optionally a operation (e.g. <scriptname>
) and a target (e.g. start_licenseactivation.exe
) can be provided.
In absence of parameter Operation it will be set to an empty string, if the executing script name is chocolateyInstall.ps1, chocolateyUninstall.ps1 or rj_install.ps1. Otherwise the executing script name without its extension will used as value for parameter.
Syntax
Parameters
Get-RealmjoinLogFilePath
Internal function for command for Get-ChocolateyRealmjoinLogFilePath
Get-RealmjoinPackageLogDir
This command returns a RealmJoin-specific location for log files depending on the script execution context.
Syntax
Parameters
Firewall
tbd
Disable-RealmjoinFirewallPopup
This command adds a firewall rule with the given executable path. The package name will set as the display name for the rule.
Syntax
Parameters
Disable-RealmjoinFirewallPopupJava
This command applies a firewall rule by adding the common java executables (java.exe, javaw.exe, jnlplauncher.exe) to the given path of Java.
Optionally the java executable file(s) can be overwritten by the parameter exeFiles (e. g. javaw.exe)
Syntax
Parameters
Disable-RealmjoinFirewallPopupJavaAppV
This command applies a firewall rule by adding the common appv - specific java executables (java.exe, javaw.exe, jnlplauncher.exe) to the given AppV package.
Optionally the java executable file(s) can be overwritten by the parameter "exeFiles" (e.g. javaw.exe).
Syntax
Parameters
Remove-RealmjoinFirewallRules
This command removes a firewall rule by its display name, typically the package name.
Syntax
Parameters
Specials
tbd
Remove-RealmjoinFileAtReboot
A given file will be marked to be deleted after rebooting the system.
Syntax
Parameters
Get-RealmjoinWrpFileProtectionState
This command returns a boolean with the value $True
, if the file protected. Typically a helper for command Remove-RealmjoinFileAtReboot.
Syntax
Parameters
Update-RealmjoinHostsFile
This command adds one or more entries to the hosts
file of the system. Behind the scene these entries are added as a block with RealmJoin - specific comments.
For an update you must always provide all (including previous) entries. By providing the switch
parameter CleanUp the whole RealmJoin - specific block of entries will be removed from the file.
Syntax
Parameters
Convert-RealmjoinStringToBoolean
Convert boolean related strings like '1', 'true', '0' and 'false' to its corresponding and valid boolean type. The default return value, if conversion failed is $false
.
The default return value can be overwritten to $true
or $null
Syntax
Parameters
Wait-RealmjoinCondition
This command loops and waits for a given condition provided as a PowerShell scriptblock
.
By default with 0.5 minutes timeout, the condition as display name and final throw of a exception by reaching the timeout. The parameter 'TimeOutMinutes', 'TimeOutSeconds', 'DisplayName' and final action 'OnTimeout' can be overwritten.
Syntax
Parameters
Invoke-RealmjoinWithRetry
This command invoke a given action (defined as scriptblock
) with retries and also executes a fail and a final fail action.
By default with maximal 4 retries and an delay of 1 seconds increased by 1.5 seconds each retry. Optionally a fail ('OnErrorRetry') and a final fail ('OnErrorFinal') action can be provided as a scriptblock
.
The parameters 'RetryDelaySeconds', 'MaxRetries' can be overwritten. The increment of the delay can be suppressed by providing the switch
parameter 'DoNotIncreaseDelay'.
Syntax
Parameters
Invoke-RealmjoinChocoPackageInstallation
tbd
Syntax
Parameters
Invoke-RealmjoinChocoPackageUninstall
tbd
Syntax
Parameters
Invoke-RealmjoinDevChocoScript
tbd
Syntax
Parameters
Restart-RealmjoinComputer
This command initiates a system restart.
By default with a delay of 10 seconds, which can be overwritten by the parameter 'Delay'.
Optionally a message can be provided by the parameter 'Message'. Behind the scene a scheduled task is created which performs a shutdown with parameter for restart.
Syntax
Parameters
Enable-ChocolateyRealmjoinAppv
This command enables AppV service on current client with BranchCache as supported. For enabling the Package Scripts support the optional parameter 'enablePackageScripts' can be used.
Publishing is only allow with administrative permissons.
Syntax
Parameters
Get-RealmjoinJavaAppvRootFolder
This command returns the root AppV path (Vfs) of Java Runtime Environment by giving any existing AppV package.
Syntax
Parameters
Last updated