Skip to content

$cs.Job_WriteLog

Writes a line of text to the PowerPack log. In PowerPack scripts this must always be called with a single positional argument: $cs.Job_WriteLog("message").

$cs.Job_WriteLog(string functionname = “”, string text = “”)

The message to write to the log. Despite the parameter name, PowerPack scripts should pass their log message here as the only argument.

Not used by PowerPack scripts. The function technically accepts a second positional argument and would log it appended to functionname, but this two-argument/tag form (e.g. $cs.Job_WriteLog("Install:", "message")) must not be used in PowerPack scripts — always call Job_WriteLog with exactly one argument.

None

A few realistic one-line log messages at different stages of an install:

Terminal window
$cs.Log_SectionHeader('Install', 'o')
$cs.Job_WriteLog("Starting installation of $global:AppName $global:AppRelease")
Terminal window
$cs.Job_WriteLog("Installation of $global:AppName $global:AppRelease completed successfully")
Terminal window
$cs.Job_WriteLog("Installation failed: setup.exe returned exit code $exitCode")

Note: If functionname is literally "$", Job_WriteLog uses the currently active log section header instead of that literal text. This is an internal mechanism used by Log_SectionHeader and is not something a script author needs to invoke directly.

$cs.Log_SectionHeader Exit-PSScript