This is the list of commandlets used to simplify logging of the deployment.
Start-Log
Starts a new log that records any output from the deployment process.
Note: this uses transcripts, which means it is only be available when running the scripts from the powershell.exe host.
It will simply be ignored when running from Powershell ISE.
Name |
Type |
Required |
Description |
Example |
Name |
string |
 |
Prefix used in the log file name |
Install_ |
Path |
string |
|
Folder where the new log file will be created. Default is C:\Logs |
C:\Logs |
AppendDate |
switch |
|
If this switch is specified, the current timestamp will be added to the file name.
If not specified, the cmdlet will use the same file name each time the script is run, and overwrite the previous log. |
|
Start-Log -Name "AppX_Deployment_" -AppendDate
Write-DeploymentSuccess
Writes a deployment success message to both the console and a global log file.
The message contains information such as the script name, the date...
You can use this cmdlet to log a non detailled entry for every deployment that happens on the target machine.
Name |
Type |
Required |
Description |
Example |
Application |
string |
 |
Name of the application being deployed |
MyComponent |
LogFile |
string |
|
Path to the log file. Default is C:\Logs\Deployments.txt |
C:\Logs\Deployments.txt |
Write-DeploymentSuccess -Application "MyComponent"
Write-DeploymentFailure
Writes a deployment failure message to both the console and a global log file.
The message contains information such as the script name, the date...
You can use this cmdlet to log a non detailled entry for every deployment that happens on the target machine.
Name |
Type |
Required |
Description |
Example |
Application |
string |
 |
Name of the application being deployed |
MyComponent |
LogFile |
string |
|
Path to the log file. Default is C:\Logs\Deployments.txt |
C:\Logs\Deployments.txt |
$ErrorActionPreference = 'Stop'
Trap [Exception]
{
Write-DeploymentFailure 'MyComponent'
break
}