Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions reference/3.0/Microsoft.PowerShell.Core/Enter-PSSession.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,27 @@ The commands that you enter run in the new session, and the results are returned
### Example 2

```
The first command uses the Enter-PSSession cmdlet to start an interactive session with Server01, a remote computer. When the session starts, the command prompt changes to include the computer name.
PS> Enter-PSSession -Computer Server01
[Server01]: PS>

The second command gets the PowerShell process and redirects the output to the Process.txt file. The command is submitted to the remote computer, and the file is saved on the remote computer.
[Server01]: PS> Get-Process Powershell > C:\ps-test\Process.txt

The third command uses the Exit keyword to end the interactive session and close the connection.
[Server01]: PS> exit
PS>

The fourth command confirms that the Process.txt file is on the remote computer. A Get-ChildItem ("dir") command on the local computer cannot find the file.
PS> dir C:\ps-test\process.txt
```

```output
Get-ChildItem : Cannot find path 'C:\ps-test\process.txt' because it does not exist.
At line:1 char:4
+ dir <<<< c:\ps-test\process.txt
```

This command shows how to work in an interactive session with a remote computer.
The first command uses the Enter-PSSession cmdlet to start an interactive session with Server01, a remote computer. When the session starts, the command prompt changes to include the computer name.

The second command gets the PowerShell process and redirects the output to the Process.txt file. The command is submitted to the remote computer, and the file is saved on the remote computer.

The third command uses the Exit keyword to end the interactive session and close the connection.

The fourth command confirms that the Process.txt file is on the remote computer. A Get-ChildItem ("dir") command on the local computer cannot find the file.

### Example 3

Expand Down
12 changes: 9 additions & 3 deletions reference/3.0/PSWorkflow/About/about_Checkpoint-Workflow.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
---
---
ms.date: 06/09/2017
schema: 2.0.0
locale: en-us
keywords: powershell,cmdlet
title: about_Checkpoint Workflow
---

# About Checkpoint-Workflow

## about_Checkpoint-Workflow


## SHORT DESCRIPTION

Describes the Checkpoint-Workflow activity, which takes a checkpoint in a workflow.


## LONG DESCRIPTION

The Checkpoint-Workflow activity takes a checkpoint, which saves state and data in the workflow. If the workflow is suspended or interrupted, it can be resumed from the most recent checkpoint, rather than having to be restarted.

The Checkpoint-Workflow activity is valid only in a workflow.
Expand All @@ -41,6 +43,7 @@ Consider taking checkpoints after critical steps so the workflow can be resumed


### ABOUT CHECKPOINTS

A checkpoint is a snapshot of the current state of the workflow, including the current values of variables, and any output generated up to that point, and it saves it to disk.

If a workflow is interrupted, intentionally or unintentionally, Windows PowerShell® Workflow automatically uses the data in newest checkpoint to recover and resume the workflow.
Expand All @@ -49,6 +52,7 @@ When you run the workflow as a job, such as by using the AsJob workflow common p


### OTHER CHECKPOINTING TECHNIQUES

In addition to the Checkpoint-Workflow activity, Windows PowerShell Workflow supports other checkpointing techniques, including the following:

-- PSPersist workflow common parameter
Expand All @@ -61,10 +65,11 @@ For more information about adding a checkpoint to a workflow, see "How to Add Ch


## EXAMPLES

The following workflow includes a call to the Checkpoint-Workflow activity after completing a long-running function and a script that share data.


```
```powershell
Workflow Test-Workflow
{
$a = Invoke-LongRunningFunction
Expand All @@ -81,4 +86,5 @@ Workflow Test-Workflow


## SEE ALSO

How to Add Checkpoints to a Workflow (http:\/\/go.microsoft.com\/fwlink\/?LinkId\=261993)
9 changes: 7 additions & 2 deletions reference/3.0/PSWorkflow/About/about_Foreach-Parallel.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
---
---
ms.date: 06/09/2017
schema: 2.0.0
locale: en-us
keywords: powershell,cmdlet
title: about_Foreach Parallel
---

# About Foreach-Parallel

## about_Foreach-Parallel


## SHORT DESCRIPTION

Describes the ForEach -Parallel language construct in Windows PowerShell® Workflow


## LONG DESCRIPTION

The Parallel parameter of the ForEach keyword runs the commands in a ForEach script block once for each item in a specified collection.

The items in the collection, such as a disk in a collection of disks, are processed in parallel. The commands in the script block run sequentially on each item in the collection.
Expand All @@ -37,6 +39,7 @@ ForEach -Parallel ($<item> in $<collection>)


### DETAILED DESCRIPTION

Like the ForEach statement in Windows PowerShell, the variable that contains collection ($<Collection>) must be defined before the ForEach -Parallel statement, but the variable that represents the current item ($<item>) is defined in the ForEach -Parallel statement.

The ForEach -Parallel construct is different from the ForEach keyword and the Parallel keyword. The ForEach keyword processes the items in the collection in sequence. The Parallel keyword runs commands in a script block in parallel. You can enclose a Parallel script block in a ForEach -Parallel script block.
Expand All @@ -45,6 +48,7 @@ The target computers in a workflow, such as those specified by the PSComputerNam


### EXAMPLES

The following workflow contains a ForEach -Parallel statement that processes the disks that the Get-Disk activity gets. The commands in the ForEach -Parallel script block run sequentially, but they run on the disks in parallel. The disks might be processed concurrently and in any order.


Expand Down Expand Up @@ -90,6 +94,7 @@ workflow Test-Workflow


## SEE ALSO

Writing a Script Workflow (http://go.microsoft.com/fwlink/?LinkId=262872)

about_ForEach
Expand Down
39 changes: 18 additions & 21 deletions reference/3.0/PSWorkflow/About/about_InlineScript.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
---
---
ms.date: 06/09/2017
schema: 2.0.0
locale: en-us
keywords: powershell,cmdlet
title: about_InlineScript
---

# About InlineScript
## about_InlineScript


# SHORT DESCRIPTION
## SHORT DESCRIPTION

Describes the InlineScript activity, which runs Windows
PowerShell commands in a workflow.

# LONG DESCRIPTION
## LONG DESCRIPTION

The InlineScript activity runs commands in a shared
Windows PowerShell session in a workflow. This activity
is valid only in workflows.

# SYNTAX
## SYNTAX

InlineScript {\<script block\>} \<ActivityCommonParameters\>
```
InlineScript {<script block>} <ActivityCommonParameters>
```

# DETAILED DESCRIPTION
## DETAILED DESCRIPTION

The InlineScript activity runs commands in a shared
Windows PowerShell session. You can include it in a
Expand All @@ -48,7 +47,7 @@ an InlineScript script block do not have the workflow features
such as checkpointing ("persistence) and workflow or activity
common parameters.

# VARIABLES IN INLINESCRIPT
## VARIABLES IN INLINESCRIPT

By default, the variables that are defined in a workflow are
not visible to the commands in the InlineScript script block.
Expand Down Expand Up @@ -76,11 +75,12 @@ Test-Workflow
```

```output
PS C:> Test-Workflow
Inline A0 =
Inline A1 = 3
```

## RETURNING VARIABLES IN INLINESCRIPT

InlineScript commands can change the value of the variable
that was imported from workflow scope, but the changes are
not visible in workflow scope. To make them visible, return
Expand Down Expand Up @@ -109,17 +109,17 @@ Test-Workflow
```

```output
PS C:> test-workflow
Inline A = 4
Workflow A = 3
Workflow New A = 4
```

Troubleshooting Note: A statement with the $Using scope modifier
should appear before any use of the variable in the InlineScript
script block.
> [!NOTE]
> Troubleshooting Note: A statement with the $Using scope modifier
> should appear before any use of the variable in the InlineScript
> script block.

# RUNNING IN-PROCESS
## RUNNING IN-PROCESS

To improve reliability, the commands in the InlineScript script
block run in their own process, outside of the process in which
Expand All @@ -131,10 +131,7 @@ the workflow process, remove the InlineScript value from the
OutOfProcessActivity property of the session configuration,
such as by using the New-PSWorkflowExecutionOption cmdlet.

For more information, see [How to Run Windows PowerShell Commands
in a Workflow](http://go.microsoft.com/fwlink/?LinkId=261983).

# EXAMPLES
## EXAMPLES

The InlineScript in the following workflow includes commands
that are not valid in workflows, including the use of the
Expand All @@ -144,7 +141,7 @@ New-Object cmdlet with the ComObject parameter.
workflow Test-Workflow
{
$ie = InlineScript {
$ie = New-Object -ComObject InternetExplorer.Application -property @{navigate2="www.microsoft.com"}
$ie = New-Object -ComObject InternetExplorer.Application -Property @{navigate2="www.microsoft.com"}

$ie.Visible = $true
}
Expand Down
31 changes: 13 additions & 18 deletions reference/3.0/PSWorkflow/About/about_Parallel.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
---
---
ms.date: 06/09/2017
schema: 2.0.0
locale: en-us
keywords: powershell,cmdlet
title: about_Parallel
---

# About Parallel
## about_Parallel

## about_Parallel

## SHORT DESCRIPTION
Describes the Parallel keyword, which runs the activities in a workflow in parallel.

Describes the Parallel keyword, which runs the activities in a workflow in parallel.

## LONG DESCRIPTION
The Parallel keyword runs workflow activities in parallel. This keyword is valid only in Windows PowerShell® Workflow.

The Parallel keyword runs workflow activities in parallel. This keyword is valid only in Windows PowerShell® Workflow.

### SYNTAX


```
workflow <Verb-Noun>
{
Expand All @@ -33,15 +31,13 @@ workflow <Verb-Noun>
}
```



## DETAILED DESCRIPTION

The commands in a Parallel script block can run concurrently. The order in which they run is not determined.

For example, the following workflow includes a Parallel script block that runs activities that get processes and services on the computer. Because the Get-Process and Get-Service commands are independent of each other, they can run concurrently and in any order.


```
```powershell
workflow Test-Workflow
{
Parallel
Expand All @@ -52,23 +48,22 @@ workflow Test-Workflow
}
```


Running commands in parallel is very efficient and reduces the time it takes to complete a workflow significantly.

To run selected commands in a Parallel script block in sequential order, use the Sequence keyword. For more information, see about_Sequence.

To run a Parallel script block on items in a collection, use the ForEach or ForEach -Parallel keywords.


## SEE ALSO
"Writing a Script Workflow" (http:\/\/go.microsoft.com\/fwlink\/?LinkID\=262872)

about_ForEach
["Writing a Script Workflow"](/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/jj574157(v=ws.11))

[about_ForEach](../../Microsoft.PowerShell.Core/About/about_Foreach.md)

about_ForEach-Parallel
[about_ForEach-Parallel](about_ForEach-Parallel.md)

about_Language_Keywords
[about_Language_Keywords](../../Microsoft.PowerShell.Core/About/about_Language_Keywords.md)

about_Sequence
[about_Sequence](about_Sequence.md)

about_Workflows
[about_Workflows](about_workflows.md)
Loading