The Start-Job command in Windows PowerShell is a powerful tool for running tasks asynchronously in the background. It allows you to run multiple jobs at once, and to manage them with ease. This article will explain the syntax, parameters, inputs, outputs, examples, and tips for using the Start-Job command.

Syntax

The syntax for the Start-Job command is as follows:

Start-Job [-ScriptBlock] <ScriptBlock[]> [-Name <String>] [-ArgumentList <Object[]>] [-InitializationScript <ScriptBlock>] [-RunAs32] [-Credential <PSCredential>] [-ThrottleLimit <Int32>] [-AsJob] [-JobName <String>] [-InputObject <PSObject>] [-FilePath <String>] [-ComputerName <String[]>] [-Authentication <AuthenticationMechanism>] [-CertificateThumbprint <String>] [-ConfigurationName <String>] [-ConnectionURI <String>] [-EnableNetworkAccess] [-NoMachineProfile] [-PSSessionOption <PSSessionOption>] [-ProxyAccessType <ProxyAccessType>] [-ProxyAuthentication <ProxyAuthentication>] [-ProxyCredential <PSCredential>] [-ProxyPort <Int32>] [-ProxyServer <String>] [-SessionName <String>] [-UseSSL] [-WhatIf] [-Confirm] [ <CommonParameters>]

Parameters

The Start-Job command has the following parameters:

Parameter Description
ScriptBlock The script block to run as a job.
Name The name of the job.
ArgumentList The arguments to pass to the script block.
InitializationScript A script block to run before the job starts.
RunAs32 Run the job in 32-bit mode.
Credential The credentials to use for the job.
ThrottleLimit The maximum number of jobs to run at the same time.
AsJob Run the job as a background job.
JobName The name of the job.
InputObject The object to pass to the script block.
FilePath The path to the script to run as a job.
ComputerName The name of the computer to run the job on.
Authentication The authentication mechanism to use for the job.
CertificateThumbprint The thumbprint of the certificate to use for the job.
ConfigurationName The name of the configuration to use for the job.
ConnectionURI The URI of the connection to use for the job.
EnableNetworkAccess Allow the job to access the network.
NoMachineProfile Do not use the machine profile for the job.
PSSessionOption The session options to use for the job.
ProxyAccessType The type of proxy to use for the job.
ProxyAuthentication The authentication mechanism to use for the proxy.
ProxyCredential The credentials to use for the proxy.
ProxyPort The port of the proxy to use for the job.
ProxyServer The server of the proxy to use for the job.
SessionName The name of the session to use for the job.
UseSSL Use SSL for the job.
WhatIf Simulate the job.
Confirm Prompt for confirmation before running the job.

Inputs

The Start-Job command accepts the following inputs:

  • ScriptBlock
  • Name
  • ArgumentList
  • InitializationScript
  • RunAs32
  • Credential
  • ThrottleLimit
  • AsJob
  • JobName
  • InputObject
  • FilePath
  • ComputerName
  • Authentication
  • CertificateThumbprint
  • ConfigurationName
  • ConnectionURI
  • EnableNetworkAccess
  • NoMachineProfile
  • PSSessionOption
  • ProxyAccessType
  • ProxyAuthentication
  • ProxyCredential
  • ProxyPort
  • ProxyServer
  • SessionName
  • UseSSL
  • WhatIf
  • Confirm

Outputs

Leave a Reply