PackageDeployment Module Help

Package Deployment Module

Invoke-PowerShellCode Cmdlet

Version 3.1.0.0

Invoke-PowerShellCode

Synopsis

Executes PowerShell code and logs the execution in the log file.

Syntax

Invoke-PowerShellCode [-Script] <scriptblock> [[-LogAs] <string>] [[-ReverseScript] <scriptblock>] [[-LogReverseAs] <string>] [[-ResultVariable] <string>] [[-Context] {Any | User | UserPerService | Computer | ComputerPerService}] [<CommonParameters>]

Description

Executes PowerShell code and logs the execution in the log file.

Parameters

-Script <scriptblock>

PowerShell code to execute

Required

True

Position

0

Accepts pipeline input

False

-LogsAs <string>

Name under which the code block is logged in the log file.

Required

False

Position

1

Accepts pipeline input

False

-ReverseScript <scriptblock>

PowerShell code that is executed when the command is uninstalled.

Required

False

Position

2

Accepts pipeline input

False

-LogReverseAs <string>

Name under which the code block of the uninstallation is logged in the log file.

Required

False

Position

3

Accepts pipeline input

False

-ResultVariable <string>

Name of the variable where the result of the code execution will be stored.

Required

False

Position

4

Accepts pipeline input

False

-Context <String>

User: Execution under user account; logging in HKEY_CURRENT_USER, i.e. for the user.
UserPerService: User-related command, execution in Service context.
Computer: Execution under user account; logging in HKEY_CURRENT_MACHINE, i.e. for the computer.
ComputerPerService: Execution in service context; logging in HKEY_LOCAL_MACHINE, i.e. for the computer.

Required

False

Position

5

Accepts pipeline input

False

<CommonParameters>

For more information about common parameters, type "Get-Help about_CommonParameters".