# Job Environment
The powerShell environment in which the {ref}`powerShell job scripts ` are executed is pre-configured.\
Before a job script is executed the following actions are performed:
- *powerVault* and *powerJobs* modules are imported as well as all script modules in the {ref}`module directory `.
- `$workingDirectory` variable of type [DirectoryInfo](https://docs.microsoft.com/en-us/dotnet/api/system.io.directoryinfo?view=netframework-4.7) specifies foreach job a unique temporary directory, located under *C:\\Temp\\powerJobs Processor\\*.
- {doc}`$job ` variable of type {doc}`powerVault Job ` is provided that represents the job that is currently being executed.
- {doc}`$host ` variable is extended with an *Applications* property that contains all registered {doc}`/jobprocessor/applications`.
- {ref}`Setup_Job.ps1 ` script is invoked.
## Setup_Job.ps1
The *Setup_Job.ps1* file is a special script that is always executed **before a job is executed**.\
It is recommended to only modify this script for actions that need to be performed before **every** job execution regardless of job type.\
It is located in the products ProgramData directory *%ProgramData%\\coolOrange\\powerJobs\\Setup_Job.ps1*
This script is responsible for setting up the following global variables:
- [$ErrorActionPreference](#erroractionpreference)
- [$IAmRunningInJobProcessor](/jobprocessor/code_reference/objects/iamrunninginjobprocessor)
Depending on the entity the Job was triggered for, the following objects are automatically created using the global {doc}`$job ` variable:
- {doc}`$file `
- {doc}`$folder `
- {doc}`$customObject `
- {doc}`$item `
- {doc}`$changeOrder `
and calls {doc}`/jobprocessor/code_reference/cmdlets/open-vaultconnection` to provide variables to access the Job Processors vault connection.
With every job execution, temporary files from previous jobs are automatically removed from the working directory by using the [](/jobprocessor/code_reference/cmdlets/clean-up) cmdlet.
### $ErrorActionPreference
When a script is executing in *powershell.exe*, the default behavior is to continue the execution of the script when an error occurs.\
powerJobs handles **Errors in scripts** differently: the job execution is Stopped when an {ref}`exception is thrown `!
This default behaviour can be changed by using the *\$ErrorActionPreference* variable:
```powerShell
$ErrorActionPreference = "Continue"
```
All the possible options are:
| Identifier | Description |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Continue | This is the default PowerShell setting. The error object is written to the output pipe and added to \$error, and \$? is set to false.
Execution then continues at the next script line. |
| SilentlyContinue | When this action preference is set, the error message is not written to the output pipe before continuing execution. Note that it is still added to \$error and \$? is still set to false.
Again, execution continues at the next line. |
| Stop | This error action preference changes an error from a non-terminating error to a terminating error. The error object is thrown as an exception instead of being written to the output pipe. \$error and \$? are still updated.
Execution does not continue. |
| Inquire | Prompts the user requesting confirmation before continuing on with the operation.
At the prompt, the user can choose to continue, stop or suspend the operation.
**Warning:** It is not recommended to use this option with powerJobs Processor! |