Invoke-LWCommand
SYNOPSIS
Cmdlet executed by Invoke-LabCommand
SYNTAX
LocalScript
Invoke-LWCommand -ComputerName <String[]> -Session <PSSession[]> [-ActivityName <String>]
[-DependencyFolderPath <String>] -ScriptFilePath <String> [-KeepFolder] [-ArgumentList <Object[]>]
[-ParameterVariableName <String>] [-Retries <Int32>] [-RetryIntervalInSeconds <Int32>]
[-ThrottleLimit <Int32>] [-AsJob] [-PassThru] [<CommonParameters>]
ScriptBlock
Invoke-LWCommand -ComputerName <String[]> -Session <PSSession[]> [-ActivityName <String>]
[-DependencyFolderPath <String>] -ScriptBlock <ScriptBlock> [-KeepFolder] [-ArgumentList <Object[]>]
[-ParameterVariableName <String>] [-Retries <Int32>] [-RetryIntervalInSeconds <Int32>]
[-ThrottleLimit <Int32>] [-AsJob] [-PassThru] [<CommonParameters>]
DESCRIPTION
Executes code on remote hosts. Has various modes of operation like transmitting dependency content or executing scripts on the remote host.
EXAMPLES
Example 1
PS C:\> Invoke-LWCommand -ComputerName Host1 -ScriptFilePath C:\StartDeployment.ps1 -Retries 3 -RetryInterval 10
Executes the script StartDeployment.ps1 which exists on the remote host Host1 with up to 3 retries and a retry interval of 10 seconds.
PARAMETERS
-ActivityName
Name of the activity. Relevant for logging and display
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ArgumentList
The list of arguments to pass to script
Type: Object[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-AsJob
Indicates that the cmdlet should run in the background
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ComputerName
The host to execute the code on
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-DependencyFolderPath
The dependencies that should be copied to the VM
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-KeepFolder
Indicates that the files copied to the remote host should not be removed
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ParameterVariableName
The name of the variable containing the parameters to pass
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PassThru
Indicates that the result should be returned
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Retries
The number of retries
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-RetryIntervalInSeconds
The interval between retries
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ScriptBlock
The script block to execute
Type: ScriptBlock
Parameter Sets: ScriptBlock
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ScriptFilePath
The path of the local script
Type: String
Parameter Sets: LocalScript
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Session
The session to execute the code in
Type: PSSession[]
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ThrottleLimit
The throttle limit for Invoke-Command
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.